Your beloved python features

CM cmpython at gmail.com
Fri Feb 5 16:56:29 EST 2010


> GvR got it right when he discarded the superfluous semicolons from the ends
> of statements--and then he ADDS superfluous colons to the ends of control
> statements? It will probably be as much of a shock to you as it was to me
> when I learned after studying parsing that colons, semicolons, "then"'s and
> "do"'s, etc.,  are simply noise tokens that serve no purpose except to
> clutter up the source.

Some argue that the colon is a useful visual cue that aids in
readability and
that "explicit is better than implicit".  I think one can feel either
way about it.
For my part, I prefer to have colons at that point, because it serves
as a
mental primer that a certain type of block follows.  Semi-colons at
the end
of statements don't seem to provide any mental priming for me that
can't
better be served by a line break.

> As for enforced indentation, back in the late 60's when I was a programming
> newbie I remember thinking how cool it would be to just indent the
> statements controlled by for loops (we didn't have none of them fancy while
> loops in FORTRAN back then! :-) )  Not too long after that I saw the havoc
> that a buggy editor could wreak on nicely-formatted source. :-( Formatting
> held hostage to a significant, invisible whitespace char? An inevitable
> accident waiting to happen! Not good, Guido; not good at all.

First, why would you tolerate a buggy editor?

I've had my share of challenges in learning Python, but indentation
problems
would be about 403rd down on the list.  A simple indentation error is
shown in
my editor that immediately gets fixed.  No havoc at all.  And I also
know that
every piece of Python code I ever get from others *has* to be readable
(at
least in terms of the very visually helpful indented blocks).

Che



Che

>
> That'll do for starters. :-)




More information about the Python-list mailing list