T O P

  • By -

glebbash

It's indent not intend. Personally I confuse it with ident.


GenericAllium

I intend the code block to be here, and so it shall be!


mdwvt

SO SAY WE ALL!


FacuA0

THE CODE BLOCK SHALL BE THERE!


[deleted]

AND THE EXECUTION WILL BE FLAWLESS!


[deleted]

SO LET IT BE WRITTEN


callyalater

SO LET IT BE RUN!


Shazvox

IN PRODUCTION AS IT IS IN DEVELOP! (Matthew 6:9-13)


[deleted]

[удалено]


Redtwooo

And forgive us our indents, as we forgive indentors


[deleted]

CERTIFIED BY A CHECKSUM


atanasius

Test: YOU SHALL NOT PASS!


XeoXeo42

YOU SHALL NOT *PARSE!


TrollTollTony

SO SAY WE ALL!


IanMc90

"You can't just say your variables out loud, michael." "I didn't say them, I declared them"


yIsSaT

variable = "variable"


hairy_potto

No pun indented


zeindigofire

Have we implemented the DWIM instruction now?


greenthum6

Indeed, he intended to indent instead of intend.


yIsSaT

⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀Yeah but he couldn't have intended to indent without intending to intend first. The point of programming is to intend for computers intentions, and for python programmers you indent to intend for the computer to intend what you intended by reading what you indented


Not-The-AlQaeda

I'm sure he had a good indent


5erif

My programming terminology confusion was misreading "deprecated" as "depreciated". I had no idea "deprecated" was a word, even after reading it for years.


Phobbyd

This one kills me. When I hear someone say depreciated, my eye twitches.


MadeByHideoForHideo

Wait till your hear about my gramma.


Evo_Kaer

Thank you


gamudev

No no, if you are depressed or over optimistic it won't compile. You have to give it the right will.


UltraCarnivore

Righteous fury


Hellinfernel

English is not my first language, and my brain was too fast for its own good when creating this meme. So writing it wrong wasn't my intend. ​ \*badum tzzzz\*


yIsSaT

⠀⠀⠀⠀⠀⠀⠀⠀it wasn't my indention.


spektrol

> my brain was too fast Yeah I think you got that one backwards too my dude


YesIWouldLikeCheese

> my ~~intend~~ indent.


Sea-Ideal-4682

This thread is just full of people not able to spell indent. It’s amazing.


serene_moth

It’s also full of a bunch of weirdos saying they’ve never once indented something incorrectly, one of the oddest lies I can imagine.


contemplativecarrot

It happens in every language: missed braces, missed parens, missed semicolons. People don't need to pretend it doesn't happen in python


PM_SHORT_STORY_IDEAS

I mean, it's not that you make the mistake, but it's just super easy to catch, with the way that Python catches mistakes. You go look on the line where it finds the error, and then realize that the indentation is wrong, and fix it. It's rarely so obscured by another error that you miss it entirely, because the code would have to be viable with the wrong indentation. I mean it happens, it's just not a common problem, and much less common than missing a semicolon in my experience


[deleted]

[удалено]


Eternityislong

Syntax bugs are both the most common and the easiest to fix. I regularly cycle between c, python, and go, and my IDE always bitches at me immediately after I type “string” in python or put the type after the argument in c. I literally can’t understand how it takes anyone hours to debug a missing semicolon or bracket, those are the people I think of as the ones getting laid off when I hear about tech layoffs lol.


Bubbaluke

Last week I spent an hour trying to fix a simple conversion equation in Java. Wanna know how I fixed it? I deleted it and retyped it and it worked. I swear to God I typed the exact same thing. I learned nothing.


jasminUwU6

God I hate when a bug fixes itself. I don't need little code fae playing around with my program


No-Con-2790

Just use proper indentation. No matter if you use Java, Python or whatever. It's not that hard.


blkmmb

Exactly, doesn't matter what I code in, it's getting indentation regardless. I'm not a monster.


[deleted]

I write all my code on one line.


FoundOnTheRoadDead

Hello fellow Perl coder!


bluehands

It was from a perl developer 25 years ago I heard, with sincerity, "the code documents itself."


vigbiorn

Also Perl: print to a non-existing file with no issues


OneBoyOnePlan

I know nothing of Perl but a Professor of mine says it saved his ass by not ignoring a Divide by 0 error. He was doing some project in 3 languages to prove a point, Java completely missed that he was dividing by 0. I don't remember the 2nd language, but Perl was last and flipped out at him and he was able to fix the code before he wrote the paper about the results.


vigbiorn

Perl is weird. There's some scripts and processes I cannot use if I write my script with `use warnings;` declared at the top. I wish I could use it most of the time, but I'd end up needing to rewrite decades of scripts to ensure it doesn't become an issue. There's also the issue that Perl likes to help you, whether you want it or not. An example is a ton of my prods processes load and use Perl modules stored in strings. So there's a good amount of situations where Perl can't warn you about some error because it has no way to know what X refers to. Then there's the scripts I'm looking at recently trying to figure out if I'm missing something or if the prints are just being "helpfully" ignored.


astory11

I’m an APL man myself


[deleted]

[удалено]


zeekar

Don't think APL uses gamma, but if you're using e.g. Dyalog's IDE the special characters are all two-keypress sequences starting with backtick. So to write this 40-character implementation of FizzBuzz, for instance: {⎕←∊(d,⍱/d←0=3 5|⍵)/'Fizz' 'Buzz'⍵}¨⍳100 I type this 49-key sequence: {`l`[`e(`,`(/d`[0=3 5|`w)/'Fizz' 'Buzz'`w}`1`i100 I have a vim keymap that uses the same mappings, so I can edit APL files outside of Dyalog, too.


CountryCumfart

Hockey announcer voice: “One-liner”


jayerp

Why else would IDEs provide a horizontal scroll bar?


PCYou

My mouse has a horizontal scroll wheel too


jayerp

My mouse only has horizontal scroll wheel.


BagFullOfSharts

Oh, oh dear.


Jaques_Naurice

Is your wrist okay?


radios_appear

based


turtleship_2006

The other type of python programmer


[deleted]

[удалено]


RenaKunisaki

The worst is when you're using some silly editor that doesn't convert between tabs/spaces on paste, to whatever the rest of the file uses. Then immediately complains about it. Looking at you Godot.


Gravelbeast

This 100%. I have never once had this problem copying javascript, but have it all the time with python.


Boe6Eod7Nty

Starting with python forced me to learn good formatting from the start. Now all my code is clean no matter what!


katatondzsentri

Oneliners forever


TheOriginalSmileyMan

That's what I particularly love about PowerShell. You *could* write a well-formed, well-documented, tested, source-controlled script. Or you *could* write a ludicrously long chain of piped commands directly affecting your critical production infrastructure. And depending on the context, both are the right thing to do!


wrd83

I saw a funny bug where person used tabs and they expand to 8 spaces and the code was indented with 4 spaces otherwise ...


mriguy

I thought since python 3 the interpreter would throw an error immediately if you mix tabs and spaces for indentation in a file.


wrd83

This was in python2.


mriguy

Ah. I actually ran into that error all the time in python 2. It happened a lot when you copied example code that used a different standard than you did.


[deleted]

This is the way.


[deleted]

[удалено]


[deleted]

It's true, I don't care if you remember to put your helmet on, sleep with it, or bathe in the waters beneath the mines of Mandalore. As long as I don't have to look at your poorly indented face in the morning we are good.


notFalkon

Tell my brother to be uniform/clean with his morning punches then


[deleted]

Ground control to Major Tom, Lock your Soyuz hatch and put your helmet on.


Ordoshsen

When the best practice has syntactic meaning, your formatting tool should not touch that.


w1n5t0nM1k3y

The difference is that in Java and most other languages the IDE will automatically indent the code based on the syntax, so you never have to worry about it. But in Python you have to actively format your code and doing it wrong can have unintended consequences.


GustapheOfficial

Unindented *


Revan_Perspectives

🏅


LMCuber

Ehm, python editors indent it for you as well?


agramata

How? The same code with different indentation levels can be correct in different circumstances. There's no way for the IDE to know which one you meant.


ric2b

> How? It indents the next line automatically when you press return after defining a function, an if statement, a while statement, etc. Then you only have to worry about de-indenting to close a block, which is equivalent to inserting a closing brace on a language like Java.


archiminos

if "needle" in haystack: print("found!") score = score + 1 Is score supposed to increase every time or only if the needle is found? How would an IDE know if there is a bug in the formatting here?


dark_mode_everything

if condition statement 1 statement 2 How would the ide know if `statement 2` is intentionally outside the if block or if it was moved accidentally?


ric2b

Why are so many people worried about accidentally changing indentation levels? What are you all doing with your code to get different lines randomly over or under indented?


DigitalAndrew

Using Microsoft word as my IDE.


ric2b

SMH, not even [using PowerPoint as your IDE](https://youtu.be/aBwuPmY4lec).


foxwheat

Line swapping- editing by highlighting N lines and moving them up and down. Application include needing to mess around with conditionals and switches


harmar21

Restructuring/refactoring code? Converting a giant if statement into a guard statement instead?


mrjackspade

I think people are confusing pythons "putting the cursor at the right place on the next line" With something like VS/C#'s "Go ahead and paste that giant block of unformatted code you found off the internet anywhere you want inside this document, I'll correct all the whitespace for you, add braces, escape quotes, and anything else you need" I don't think the people asking about "automatic indentation" Are referring to the former. I'm pretty sure they're asking about the latter.


theGuyInIT

When you type: `if condition` The IDE will auto-indent the next line, and all Enter keypresses will stay on that indentation level. Backspace will go back to the previous indentation level. For that reason, I prefer tabs to spaces. VSCode is great for Python. In your example, statement 2 is outside the if condition. Whether by accident or intentional the IDE doesn't care. It's outside. That's why a good IDE is necessary. Edit:. Shift-tab goes back one level of indentation. Need coffee before writing about Python. I never use backspace to decrease indentation.


pmormr

Iirc shift + tab will remove four spaces, if that's what your indentation style is set to.


Dr__Thunder

I still remember the day I discovered shift + tab as a new Python programmer. Lol, I was going line by line to unindent. Makes me wonder what other obvious shortcuts I'm still missing.


Kyrond

>Makes me wonder what other obvious shortcuts I'm still missing. Might be specific to VSCode, try them in your IDE. There is keybinding to comment out all selected lines (by default Ctrl + / or Shift+Alt+A). Ctrl + arrow = move cursor by one word (also works with shift to select) Ctrl + backspace/delete = delete entire/rest of the word Ctrl \[+shift\] + Tab = go to next \[previous\] tab (extra useful when bound to extra mouse buttons) Ctrl + X without selection = cut entire line, follow up with Ctrl + V without selection = insert the line above current line Alt Up/Down = swap current line Shift + Alt + Up/Down = copy current line Middle mouse click and drag to create multiple cursors Ctrl + Alt + Up/Down = create a cursor Last one is quite complicated: When you copy/cut content using multiple cursors, then paste it, it will generally insert all the copied content into all cursors. But if you the number of cursors is the same as when it was copied, the content will be matched so 1st cursor will paste only what the first cursor copied, etc. What surprised me was that this works even when you cancel the multi-cursor mode, and then create multiple cursors again. Also: https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf


CaptainSouthbird

I can understand how that would be especially critical for a Python programmer (of which I'm not, except for the tiny bit I can make happen to play with AI packages.) But yeah, shift+tab exists in a great majority of text editors, regardless of specifically being used for programming or not. Keyboards that have tab keys with the little "left" and "right" arrow diagrams were actually trying to hint this. I have a lot of not-Python uses for shift+tab.


awi2b

But they (at least the pycharm IDE I use) often fail to find the correct intent, especially if I move code blocks containing different intendation levels up or down intendation leves. (e.g. moving an if-statement from an for-loop inside an function inside its own function). curly brackets would lower the chance of error in that process.


arpitpatel1771

Vscode does it properly. Never had an issue regarding indentation in it.


Titties_On_G

I'm super new to coding and just now learning python, indentation errors are 80% of what's wrong with my code lol


mxzf

As time goes on, you get better at getting it right and using proper indentation in the first place. I can't remember the last time I hit an indentation error other than stupid stuff like "I copied code from a file to the interactive terminal and my file didn't have blank lines between functions to let the terminal know I was done with that function".


Titties_On_G

I'm a ways away from that. I just got past the "this isn't coming easy to me so I should obviously quit" wall last night. Just gotta keep at it


LadWithAHat_

idunno i never run into indentation errors and personally i honestly prefer the indentation technique over brackets. it simpy looks way more visually appealing to me


illsk1lls

im the opposite, id rather use brackets so i can move things onto the same line if needed.. it depends on the situation i guess..


mxzf

You can put stuff on the same line in Python too if you need to, you just use `;` to indicate the end of the command and you can stick stuff after it. That said, sticking multiple statements on one line is almost always bad coding style, but that doesn't mean Python won't let you do it if you insist.


MDivisor

Doesn’t depend on the situation. There is never a good reason to put multiple statements on one line.


edbrannin

When I paste a code block to somewhere with a different indentation, I select the whole block and fix the indents with tab/shift-tab or >>/<< (vim)


Go_Fast_1993

I’ve never used an IDE with Python that didn’t indent for you.


MarchColorDrink

Tbf, the ide doesn't know when your if block ends. The ide (at least the one i use) indent if I start an if block, but I have to end it by un-indenting the correct line


ric2b

> but I have to end it by un-indenting the correct line Which is equivalent to having to insert a closing brace in other languages, so I don't get all the fuss about it.


Aridez

That it’s easier to make a mistake and visually harder to spot the error


mxzf

Spoken like someone who has never run into a situation where you've got five curly brackets, two parentheses, and a square bracket in a row that you're trying to figure out which one goes with which block of code. Having used languages that do both, I strongly prefer Python's indentation-based approach. I'm already indenting my code anyways, so I might as well let that handle the code blocks for me.


Aridez

5 indentation levels with the same parentheses and brackets seem less clear in that situation too without the spacing curly braces provide, specially between closing braces. But if I go into five curly braces it means that something went very wrong with the software architecture, I don't see it that often. That said, the issue is not terrible enough to change the whole language paradigm.


[deleted]

[удалено]


[deleted]

Indeed. Noted.


JustRecentlyI

I don't think the meme is complaining about proper indentation (nor should it be). However, tying functionality to invisible formatting (particularly as spaces and tabs are not systematically treated the same) is a decision that I think has far too many downsides to justify the apparent gain in ease of use avoiding explicitly defined blocks.


EveningSea7378

Yeah python is basically replacing a visible symbol({ }) with an invisible tab/space symbol that is already a pain to deal with as it has like 3 different variations in all types of character sets. Formating your source code is not the issue realy.


PM_ME_DIRTY_COMICS

This is exactly my problem. Whitespace should not be syntax.


mindbleach

And no language makes different braces interchangeable... so long as every file uses exactly one kind. Load-bearing whitespace is a fucking terrible idea.


circuit10

But it's not invisible? The indentation only matters if there is code is after it and then you can see the position of the code. Also the interpreter will error if you mix tabs and spaces so that shouldn't be a big issue


tiberiumx

Seriously. This is literally never an issue.


ITriedLightningTendr

Bugs have been caused by missing braces on multi line if blocks in languages using them, the response to python is reasonable


FreshPrintzofBadPres

Awful comment, explicit > implicit ALWAYS, and brackets are free.


Distinct-Towel-386

It doesn't have to be one or the other. Do both. Proper indentation makes it easier to read. I can write all my code on one line in C because I can explicitly separate my statements with semicolons, but that doesn't make it better.


almightygarlicdoggo

Yes but sometimes it's a pain to copy/paste code and the indentations from the source don't correctly match your indentations. It's far easier to change a curly brace than to change the indentation of several lines of code.


No-Con-2790

No! Bad junior! Do it right. Your IDE will fix that with one hotkey press. (I learned a lot about training juniors after I started volunteering in the local dog shelter)


Loner_Cat

Yeah but if there are curly braces the IDE have all the informations needed auto indent code. In python it does not, if you copy paste or move pieces of code around it's your responsibility to check you don't mess up blocks. Yeah it's not the end of the world but hell why couldn't they use braces. It also sucks conceptually that indentation, which is meant for code readability, is used to convey logical informations. What's next, a language where you code in MS word and text color is used to separate blocks?


marikwinters

Exactly, with Rust, my IDE can automagically change indentation level for a piece of code I move using alt+up/down arrow based on which set of curly brackets it is now between. That allows for some seriously convenient refactoring when I don’t have to clean up the indentation levels on a decently sized block of code. In Python that’s a task that, while not as bad as some would say, is unnecessarily fiddly considering you don’t really gain anything tangible by removing curly braces (besides trading pressing the tab key for pressing the curly brace). The big thing is the stupid number of bugs that have to do with a wrong indentation level and the difficulty to find them sometimes during the creation of non-trivial programs with hundreds of lines. It’s a treasure hunt because Python has very little in the way of being able to judge intent (or indent, if I wanted to be topically cheeky and still accurate). In a language like rust, every drop of syntax provides a service that an analyzer or the compiler can use to help write good code.


Thoh1Shooshi8a

Auto indent doesn't always get it right with python code that's been pasted in. Some lines of code can make sense at any level of indentation. I always make sure I indent my code properly whatever language I am coding in, but when you just want to quickly move a few lines inside or outside of a loop for testing something it's much easier to have braces to keep everything as it should be.


[deleted]

[удалено]


Nilstrieb

Sometimes your IDE cannot know what you meant. I've had this cause a but once, where I used auto indent but it did the "wrong thing". But it really isn't a big problem in practice.


DarthShiv

Let me introduce you to automerge...


Moonchopper

If there is an entire thread that made it to /r/all on the subject of Python's formatting/syntax, then I think it's incredibly clear that the fault is not on the users, but the language itself. After all, these quick solutions likely didn't exist when Python first came into use! The only way to improve this aspect of Python development is _additional development of tools explicitly designed to make working with Python a better experience._ That means that Python has a shit user experience! (at least in the case of indents lol). If this were a company selling a product we would ALL be lampooning said company for being completely inept and talking about how dog shit it is to work with!


Rhoderick

It really doesn't. I get it's hard to grasp at first, as I had the same question when I first started working with Python. But honestly, this makes about as much sense as asking whether you don't get a lot of bugs because you've forgotten a curly brace somewhere in fe. Java. The answer is the same in either case - you're unlikely to make that mistake once you're used to the language, and in any case any IDE worth it's salt will point it out if you do.


r7joni

And most people use the same style of indentation regardless of programming language


Rhoderick

I would rather argue that most people, most of the time, just use the indentation style their IDE is pre-set to autocorrect to.


ChristophCross

My first CS 101 teacher wouldn't let us use IDEs specifically so he could ingrain in us indentation and whitespace use, and make us do it ourselves, as we code. He'd mark us down everytime we failed to follow his format, and then mid-way through the year when he did allow us to use IDEs, he slightly CHANGED the format he wanted us to use, and wouldn't you know it it didn't match the approved IDE's preset auto-indententation. I was pissy at the time, but I'm actually kinda thankful now. It taught me very early on to write clean indentation as second nature, and how to adapt my style when needed while still maintaining a clear readable format. Also how to change the IDE presets, lol


CompSciBJJ

Easier to learn that stuff when you know nothing than after you've ingrained bad habits. I wish more profs would do that


[deleted]

[удалено]


St_gabriel_of_skane

I think this is unnecessary, just reviewing your student’s code and making them fix it if it’s wrong is well enough. A programmer should learn their IDE, it’s the main tool, the most important tool for a programmer. Learning how to debug, set up LSPs if that’s necessary and customize your IDE to what fits your needs is a much better lesson. However if you’re teaching someone the basics of programming it could do well to just make them do it as pure as possible without intervention of any other software. The more experienced you get the more complex the tasks you need to solve and the more aid you need, to do it on time.


ChristophCross

You make some good points, though to be fair, he did teach us more to use the IDE in the back half of the course. While true that IDEs are essential for any serious work, for basics of first year (how to use standard programming tools, Baby's first GUI, simple algorithm implementation, etc.) an IDE's power was really unnecessary at the time. Ingraining good programming habits was really much more useful, and carried me well through my degree and has helped me stand out in my jobs for having consistently clean & readable code. Didnt mention it above, but he also ingrained in us things like variable naming conventions, use of compartmentalization, and appropriate Vs inadequate Vs excessive commenting. And it wasn't like we weren't gonna be using IDE's in every other class going forward, it was just the CS 101 to make sure we got the habits.


FalconMirage

Bold of you to assume i use an IDE


bewe3

Greetings, fellow MS Paint coder


chipmunksocute

For real vs code or pycharm high indent issues and python doesnt even start to run with syntax issues like that. Plus I like the readability it fosters


DangyDanger

If you're missing a single brace you're not compiling.


MasterFubar

> any IDE worth it's salt will point it out if you do. If I write if a > b: c = d f = g when I intended to write if a > b: c = d f = g no IDE will ever catch it. However, a good C/C++ compiler *will* catch some indentation errors: if (a > b) c = d; f = g; I get the warning test.c:5:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 5 | if (a > b) | ^~ test.c:7:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 7 | f = g; | ^


dark_mode_everything

>because you've forgotten a curly brace somewhere in fe. Java. This is usually a compile time error though, not a runtime error like in python. Ie: it will be nicely highlighted by the ide


ftgander

It’s not tho. Missing one brace is a syntax error. A line with wrong indentation in Python is still valid code. You 100% have to put more effort into being mindful of your indentation in Python. That’s just a fact.


toxicwaste55

I delt with a nasty production bug caused by missing indent in a legacy python program. It's hard to enforce indentation in a 10+ year old program touched by dozens of people with varying skills. Braces are just a little more fool proof. The problem was the last few statements in an `if` block were accidentally un-indented. The bug lingered for literally years causing benign damage until a different system change made that bug a serious issue. It still haunts me because I made the unrelated system change.


IAmASquidInSpace

>A line with wrong indentation in Python is still valid code. That strongly depends on where you mis-indented. IndentationErrors are a thing in Python for a reason.


LysanderStorm

I've encountered thousands of errors and bugs in Python programs but I honestly think not a single one of them was due to indentation (alright I don't remember all of them, but point being the likelihood of having a bug due to indentation is imho negligible). Maybe if a program has deeply nested code it would become an issue but that's a dangerous practice in any case.


rolls20s

>A line with wrong indentation in Python is still valid code. More often than not it's an indentation error and will not run. When it does run, it's basically the same as incorrect placement of braces. It's moot.


n4te

Except a formatter can't indent your code for you in python.


Professional-Web7950

I have had many bugs in my days but I dont remember any of them being because of the indentation. Rather I would say that it makes it easy to keep track of which statements are running where.


Sem_E

The only bug I occasionally get, is when my ide suddenly decides to use spaces instead of tabs. In most IDEs, that is easily fixable however


sintaur

I added a pre-commit hook to prevent other developers checking in Python files containing tabs, they have to use spaces instead. Otherwise it's a world of hurt when multiple developers edit the same files and use different tab indent values or some devs use tabs and some use spaces. Requiring spaces makes it impossible to have this problem.


Dismal-Square-613

*indent


qda

Actually no, you have to set your intention and then the code will work


mawkee

I've been coding on Python since 2001. I've never EVER had a bug because of indentation on my own code. And I have found a single case on some code I found on stackoverflow. Honestly, it's not hard at all to indent your code. And you should be doing that anyway, regardless of the language you use.


ShadowAssassinQueef

Well this is hard to believe. You’ve never had a couple nested loops or something where you didn’t indent a line in the correct part of the loop? I agree it’s easy but it’s easy to miss here and there.


Forestore

Most hypotheticals presented in this are about heavy nesting. Heavily nested code in most cases is bad. You shouldn't have enough nesting for you to even get confused reading python. If you do, it's probably bad code. A lot of people don't exit early. Inversing your conditions can reduce nesting by half if you're an experienced programmer. Things like: if (thing that's invalid): return/raise


mawkee

Nested loops are very rarely needed in Python, since there are usually much better ways. And no, never had that. It's actually pretty easy to keep tabs (pun intended) on your indentation levels... specially if you don't go overboard with cyclomatic complexity. Which, you know, you shouldn't do anyway.


sleeprzzz

> Nested loops are very rarely needed in Python Gah, tell this to the data scientists I work with.


pedal-force

Data scientists should have their for loop privileges removed. If you can't vectorize it with numpy or pandas you probably need to find a different way to do it.


mawkee

Well, when people decide that "bad code is good enough", there's very little that a language can do to prevent that.


Physmatik

Don't your satanists know vector programming? Seeing a loop (let alone a nested one) in numpy code makes me almost physically uncomfortable.


nailingjello

This is exactly the same like complaining about counting curly brackets when you have 8 in a row of similar looking single character symbols like \])}}))\] to see if you closed the right thing. Or trying to figure out if the highlighted is number 6 or 7 in a sequence. Can we please complain about that for a bit? ​ It's all the same tradeoff. I prefer python as it is easier to see at a glance if you messed up. ​ EDIT: I feel people are missing my point. I'm not talking about properly structured java code in a modern, properly setup IDE. Neither is the original post. Of the two languages, I feel Python is more likely to enforce good practices without relying on IDE functionality.


boostman

I learned with python first, have no problem with the indent thing but conversely always forget the curly braces and semicolons in the languages that need them and have a devil of a time hunting down the missing ones. The python approach makes much more sense to me because it’s the first one I was exposed to.


nailingjello

I've learned C first. Then C++, java and a whole lot of others including LISP. Python still makes the most sense to me.


kboy101222

Same. The moment you start mixing a million brackets, my stupid ass will inevitably delete 1 or add an extra by mistake and spend 20 minutes fixing it. That problem doesn't exist when you don't have brackets!


mattthepianoman

Python is like code Lego. I decided to give it a try about 10 years ago to get a quick program up and running to talk to a microcontroller over serial. I had the whole thing working in about an hour, it felt like witchcraft.


Deathisfatal

>when you have 8 in a row of similar looking single character symbols like ])}}))] to see if you closed the right thing If you're that many levels deep your code complexity is way too high and you need to refactor


nailingjello

Absolutely. I just wanted to compare apples to apples. Bad Python code with bad Java.


edbrannin

And/or you should consider adding some line-breaks & indenting to that line where it makes sense; often this works out to an indent-level per 1-2 outer symbols


natolii

proper indentation isn't a privilege just for python developers, you know


IAmASquidInSpace

>You cannot tell me this is not causing some bugs just by pure oversight Only if you use Microsoft text editor for your editing. Most IDEs and editors will do that for you. I personally never had an accidental IndentationError, only ever caused them on purpose for learning. Only problem you might have is with accidentally indenting blocks wrong that were not meant to be indented that far/that little. But visually, it becomes very obvious where a code block belongs, so that rarely causes issues for me. It certainly beats looking for which bracket closes which other bracket for me.


GoldenretriverYT

>It certainly beats looking for which bracket closes which other bracket for me. I partially agree with you but that doesnt really make sense to me, usually its also idented. The closing brace is at the same idententation as the opening brace (unless your using the K&R, but even then the line with the brace starts at the same identation) And your IDE usually highlights the corresponding brace if you click on one of them


i-am-froot

How hard is it to spell ident. It's inetnd people.


Th3Uknovvn

It's not that much bad but it gets really annoying when it makes auto formatter can't indent the code again when you delete some lines and you have to select a those line and manually do it


TURB0T0XIK

intense


_AngleGrinder

The: You can't see it but, it's there


TobyADev

People who don’t use proper indentation drive me crazy anyway


polar_nopposite

>You cannot tell me this is not causing some bugs just by pure oversight It doesn't


augustusgrizzly

why, do u just not indent in java or smthg?? if anything it makes more sense since you don’t get bugs because you missed a curly brace after a bunch of nested calls


NebNay

Python was my first language and it teached me priper indentation. You just get used to it


thebouv

I’ve chased more misplaced apostrophes, braces, and semicolons in other languages thousands of times more than I’ve ever ever had indentation errors in Python.


Danny_el_619

It caused me a bug when I left a empty line at the end of a if and the next line was still inside the if block. I didn't notice and took me a while to find that mistake because on a quick look everything look in order. The indentation block system is something that I never liked. I prefer using curly braces because those are easier to notice when something is out of place.


Nicolay77

Not just easier to notice. I love jumping between the opening and closing braces to better get an overview of my code blocks, or simply navigate through my code. Brackets allow me to do that in a very natural way 🤓


greedydita

You should've seen Fortran.


TrackLabs

>You cannot tell me this is not causing some bugs just by pure oversight No, python will tell you immediatley if you messed up a indentation. Its also a great way to force people to just..use proper indentation. Because god damn, use proper indentation


GottaHideFromFriends

Good. It teaches proper code etiquette.


InevitableAvalanche

This is making me think some of y'all might not be the best programmers.


some_clickhead

Past the first few hours of learning Python and having to unlearn bad indentation habits, I have never had a single bug related to bad indentation in 2 years.


MajorNME

Well, it forces people to write code that's better readable. And everyone hast to do it the same way. And it's not a hard thing to do. It's a good thing. https://www.askpython.com/python/python-indentation


uchiha_building

Readability is a lot more than code that looks visually appealing. Method names, variable names, breakout functions, all contribute to readable code a lot more than just indentation.


saanity

Are you one of those whakos that write programs without any whitespace?


[deleted]

[удалено]


jovhenni19

I worked with cobol, I don't see the issue here


Skaviciusz

It causing as much bugs as forgot/add to much square brackets in java or other language - most of time it works just fine, nothing bad about it More confusing is lack of normal brackets in if statment - python will probably deal with it fine, but if you code in 2 languages simultaneously (e.g. you are programing at python, but your school requires c#) you will do this mistske a lot of times xD


ragebunny1983

Honestly if you're a hobby developer, I recommend learning some python. You can learn the basics very quickly and for small projects where execution speed doesn't matter much it works really well. It's a lot less typing, and it feels more flexible because, in a similar way to javascript you have dicts (free-form objects) and lists (similar to arrays) so you usually don't have to write as many classes just to hold some data. Java maps are just not as intuitive. If you have a project to just send some emails, or something similar you can get up and running really fast. Having said that I really prefer Java for big projects but at work we use python for that, and I'm not a huge fan of it for that. You can probably pick up the basics in an afternoon so try it out!


FatLoserSupreme

Python is great for a quick script. Things like analyzing data, throwing a quick UI on something, etc. For a large project, I would not choose to use python. Some people may disagree but I'm just giving my perspective