You are viewing a single thread.
View all comments View context
4 points
*

Just curious, what about spaces made it hard? What language would have been easier? In curly brace languages, 99% of the time, a curly brace is followed by a line break and an indent. Python is similar except it’s typically a colon, line break, then indent.

What I have learned is: If the code is indented too deeply, it’s a code problem, not the language.

Torvalds infamously wrote:

“… if you need more than 3 levels of indentation, you’re screwed anyway, and should fix your program.”

permalink
report
parent
reply
2 points

Torvalds wrote this about C. There’s plenty languages where it’s much more common and less of a complexity indicator to open up scopes.

permalink
report
parent
reply
6 points

Correct, I linked the source of the quote. My implication is the general idea is applicable here. Is python one of these languages where it is idiomatic to nest code deeply?

The Zen of Python:

Flat is better than nested.

From the python I have seen and written, deep nesting is avoided.

permalink
report
parent
reply
2 points

Too much nested code was likely part of the problem, but not being able to easily tell where a block of coded ended without seeing the top of the block made it difficult to work with.

permalink
report
parent
reply
2 points

That’s fair! Takes time to get used to. Modern editors make this easier by highlighting the current indent level, or can even make the top X lines of the current closure “stick” to the top of the editor for those really long blocks.

permalink
report
parent
reply
2 points

Having those features would really have made it easier. I have only ever written my python code in Sublime Text. While it is a sublime text editor, at is not ideal (compared to how it is to write Java in IntelliJ) for Python. (Maybe with addons but I never delved into that more than a few.)

permalink
report
parent
reply

Programmer Humor

!programmerhumor@lemmy.ml

Create post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.

Community stats

  • 5.3K

    Monthly active users

  • 884

    Posts

  • 8.9K

    Comments

Community moderators