Nobody should be encouraged to change their editor. Neither do you
know why the person chose the editor they chose, nor do you actually
help in solving the problem the person has.

To try to answer to the substance of the complaint about
indentation-driven structure: when Python was created, the trend in
formatting of structured text was to eliminate punctuation as much as
possible. It was (naively) believed that punctuation makes code harder
to read (it was also the time when various languages with abundant
(eg. C) or very monotonous (Common Lisp) punctuation were mocked for
these specific qualities. Some, like in the ALGOL family of languages
chose to replace punctuation with words (eg. begin procedure X ... end
procedure), but this was seen as not satisfactory because it drowned
the important identifiers in the sea of syntactical "noise".

Python, as well as eg. YAML chose to rely on indentation. This created
its own set of problems: the more levels of indentation there is, the
harder it is for a programmer to recognize the structure. This also
made parsing programs unnecessarily more difficult, since the
languages were no longer context-free. Moving structural pieces of
code around became more difficult. At the time, the counter-argument
was that this restriction also enforces good taste: compelling
programmers to write shorter functions or other control structures. I
don't buy this argument because, in practice, a programmer will often
deal with the code written by another programmer, who didn't
necessarily want to write short low-complexity bits of code, and will
suffer the consequences.

If there's any conclusion to be drawn from the history of the use of
punctuation, it seems to me that moderation is more important than the
selected approach. Selecting multiple approaches at the same time (eg.
Haskell: both indentation-defined structure and a lot of punctuation)
gives the worst results overall. Moderate and consistent use of
punctuation that is still visually diverse enough to identify
structure (eg. Prolog) is the best, in my view.

I believe that the Python creators chose wrong. Was it possible to
know back in the day? -- I can't tell. From what I know about the
history of Python, in its early days it wasn't intended for the role
it plays today. It was more of a teaching aid, not intended for
serious, large programs. Perhaps its purpose informed the choice. But,
likely, it was just an accident of following the fashion trends
without much analysis. You can see this aspect of Python as "technical
debt", but it's a kind of debt that's unlikely to be ever repaid due
to a lot of technical difficulties that changing such a decision would
entail. So, like it or not, the indentation-driven structure will stay
in Python in the overseeable future.

On Tue, Dec 16, 2025 at 5:58 AM Greg Ewing via Python-list
<[email protected]> wrote:
>
> Any decent programming editor will have a facility for selecting a group
> of lines and adding/removing the appropriate commenting characters.
>
> (If your editor doesn't have that, then by definition it's not decent. :-)
> --
> https://mail.python.org/mailman3//lists/python-list.python.org
-- 
https://mail.python.org/mailman3//lists/python-list.python.org

Reply via email to