Python style guidelines
Robert Brewer
fumanchu at amor.org
Thu Mar 11 17:49:55 EST 2004
Will Berry wrote:
> Style guidelines and coding standards are the devil!
Meh.
> I think nothing is more evil about coding standards than indentation.
> My code (not only in Python but in C/C++ and PHP as well) for
> whatever reason always ends up having about 6 levels of indentation
> in some places.
>
> If the "standard" indentation is anything more than 2 spaces:
> for each little loop or conditional:
> you have to indent more and more until:
> long lines of code (such as calls or complex \
> mathematical expressions) have to span more \
> lines than they would if only the indentation \
> were shorter
> else:
> you could simply wrap longer lines and complex \
> mathematical formulas without indentation on the remaining \
> lines but that just makes your code look like garbage
1. Using English sentences to "prove" arguments about formal languages
is always a bad idea.
2. Complex mathematical formulas are subject to readability concerns
just as much as any other statements. If your lines are getting too
long, break them up into a series of smaller statements. I have yet to
hear a reasonable argument to *prefer* a single, long, complex
statement.
Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org
More information about the Python-list
mailing list