5 ms·
Python uses indentation for nested scope (I think that's the right term). While other languages might use curly braces or even keywords like do and end to enclo
by BanazirGalbasi 3y ago
Python uses indentation for nested scope (I think that's the right term). While other languages might use curly braces or even keywords like do and end to enclose loops and functions, Python uses indentation. It ensures code is readable, but coding newbies have to learn about whitespace errors AND scoping together. It's one of the parts of the language I dislike the most.
- 2Gkashmiri 3y agoits like trying to learn to drive while the car is actively trying to not let you drive. you can do it but its not fun. i want to do a loop, i dont want to learn to be forced to understand indentation. that kills the enthusiasm imo.
- zo1 3y agoIt's like learning to drive the car whilst sticking to the rules of the road and staying under the speed limit. It's not supposed to be fun. Besides, I don't know what backwards IDE you used. I've been doing python for 15 years and have never had to manually indent squat, ever. It sounds more like you didn't actually try python but read about the whitespace indentation somewhere and decided to chime in. Either that or you tried it in notepad.
- 2Gkashmiri 3y agoi have used notepad for ahk. that's the preferred IDE
- Loocid 3y agoIs it really that different to being forced to understand scoping with curly braces in other languages?
- 2Gkashmiri 3y agolook up a random autohotkey code. you can write it sideways, it will work. you can write it with indentation, it will work. it will work if the whole code is in a single line. on one hand, it has the least amount of startup for a new programmer because it can teach you to do cool things. on the other hand, like me, the "habits" get wrong because i never learned to do pretty code.
- pmontra 3y agoIt's like learning to write but not wanting to learn punctuation. You might end up with the Ulysses but more likely than not you'd end up with something that other people and yourself won't be able to understand well when you look at it on the next day. That said, I'm in the camp of curly braces (or equivalent) plus an autoindenter. Either a code formatter or the editor itself. Braces and random indentation is the worst that can happen.
- wruza 3y agoScoping is essential for general purpose programming, so it is usually fused into the syntax of any GP language in a form of {…} or begin/do…end. Python is one of the languages which try to remove this character and keyword noise based on observation that to see scoping people usually correctly indent their scopes, so python makes indent itself important. I can recommend using Notepad2 if you want to use GP languages but don’t want to use an IDE (which is understandable as it brings a cognitive overload when you learn). Notepad2 is a drop-in replacement for Notepad, but may be installed as a separate app. It’s not particularly for programming, but has related features that Notepad should have had for ages.
- xchkr1337 3y agoIt's weird how python defaults to spaces rather than tabs, as tabs would make indentation errors less prevalent and a lot more obvious to people learning the language.
- gattilorenz 3y agoDoes it? You can perfectly use tabs, just dont mix them up (also a source of Python pains)