upvote
2026 and still talking about python indentation? what's next, `goto` gripes?
reply
its not becauae its 2026 that stupid indentation got better
reply
When has it ever been an issue in use?

People complained about this in 1999 but then I used it and it's never mattered.

reply
It’s an issue when generating python, I can tell you from experience. It’s also a pain to not be able to safely rely on an auto formatter
reply
Every python developer I know uses an auto formatter today, and never needs to think about it (ruff, black). It's not ambiguous and is immediately visible if something has the wrong indent.

(On other projects, I often wish other languages had formatters as good and standard as the Python ecosystem. I have many complaints about Python but whitespace is just not a problem I've seen)

reply
Today and forever, I was using ActiveState IDEs back in the day, I started using Python in version 1.6.

Also it isn't the only one, many ML derived languages also use indentation, including the famous F#, Standard ML, OCaml, Haskell,....

reply
You missed the point. I’m well aware python has formatters, I use them and implemented my own. The point was that when generating/manipulating python code you cannot just generate in whatever format then run a formatter. you need to carefully keep track of the exact indentation at place where the code in written
reply
Fair. That is a very slight friction on what is quite a small niche, though (compared to the wider ecosystem of developers). And most that need similar will use AST or runtime construction.

The trivial kind of raw source generation is still trivial, but I'm guessing you're doing embedding/templates or something?

reply
It’s definitely niche!
reply
If I were doing this, and the code generator was itself in Python, I'd probably use ast and/or tokenize to avoid having to manipulate literal whitespace.
reply
Have you never tried to paste python code from the internet into an editor? At least half the time the indentation is screwed up and I have to go in and figure out manually where to put the spaces in. Indentation gets screwed up by pasting in other languages too, but with those I can generally tell the editor to reindent and it can because the information is included in the source code.
reply
Python's significant indentation does have real costs, but they mostly don't affect experienced programmers working on real codebases in real editors or IDEs. Rather, they are things like, it makes the REPL more cumbersome, and newbies sometimes find that code they copy-paste from the Web mysteriously fails to work.
reply
Oh nooooo, they fucked it up too. Why would someone make a language that’s whitespace sensitive? It’s confounding.
reply
Why would someone make a language where the programmer and the interpreter have two different ways of figuring out where blocks start and end?
reply
at the closing curly?
reply
Programmers look at the indentation.
reply
this discussion is so dated...
reply
llms prefer indents too
reply
They seem to be quite okay with oneliners, have you not noticed ?
reply
To weed out programmers who don't indent.
reply
identation should be something the compiler does not care about
reply
Like with array base indexes, there are plenty of languages that start with something other than zero, and many that use indentation, including a few well known in hacker circles, Python isn't alone.
reply
I never understood this.

What kind of special whitespace requirements do people have?

reply
I like significant invitation, but I still wouldn’t choose it if I was designing a language today.

Functional-style programming has become much more popular since Python was designed in the 1990s, and there doesn’t seem to be a good way to have Python-like significant indentation and also support true anonymous functions.

reply
True anonymous functions has nothing to do with indentation, ML derived languages are also indentation based.

Guido doesn't want them in the language, as simple as that.

reply
As I understand it, Mojo’s goal is to be able to match state of the art performance for parallel algorithms and be able to use the exotic GPU hardware. A functional style is not necessarily productive in that context.

One interesting PL concept they implement are linear types https://mojolang.org/docs/std/traits/anytype/AnyType/

reply
Haskell has significant indentation and anonymous functions.
reply
Haskell's significant indentation is, in my experience, much worse than Python's at fading into the background by matching what you would have done anyway.
reply
Scala 3, F#, CoffeeScript, Nim, Haskell, Elm, PureScript...
reply
deleted
reply
It's really not that bad
reply
Significant indentation is why people love python. Can 2 billion people be wrong?
reply
deleted
reply
I could get started about religions now...
reply
yes the majority is often very wrong
reply