Python scoping

Steve Horne sh at ttsoftware.co.uk
Thu Oct 26 11:41:16 EDT 2000


On Tue, 24 Oct 2000 15:46:30 -0400, "Joshua Muskovitz" <josh at open.com>
wrote:

>> this tends to diminish the number of lines in a "scope", and thus
>> optimizes for the chance that both ends are simultaneously visible
>> on a single page, does it not ?
>
>Driving without my headlights at night tends to diminish my overall speed
>and distance I prefer to travel, but it doesn't make my life easier or
>safer, does it?

The end of an indented section is at least as visible as an 'end;' or
a '}'. Especially programmers using C, C++, pascal and other languages
seem to have a wide range of stupid places that they habitually put
these symbols, rather like having headlights on the roof and pointing
upwards!

If you read style guidelines for C, C++, pascal, modula 2, and ada
you'll see consistent indenting is one of the most basic and important
aspects of good readable code. But none of these languages enforce
this - and it's easy for a program to evolve through maintenance to
have very confusing half-done-but-inconsistent indenting. Believe me -
I've worked with large programs in all these languages and more, and
Python scores very high in readability.

-- 
Steve Horne
sh at ttsoftware.co.uk



More information about the Python-list mailing list