Striving for PEP-8 compliance

John Nagle nagle at animats.com
Fri Apr 9 14:36:43 EDT 2010


Lawrence D'Oliveiro wrote:
> In message <mailman.1610.1270655932.23598.python-list at python.org>, Gabriel 
> Genellina wrote:
> 
>> If you only reindent the code (without adding/removing lines) then you can
>> compare the compiled .pyc files (excluding the first 8 bytes that contain
>> a magic number and the source file timestamp). Remember that code objects
>> contain line number information.
> 
> Anybody who ever creates another indentation-controlled language should be 
> beaten to death with a Guido van Rossum voodoo doll.

    No, the dumb thing was shipping a Python implementation which accepted both
tabs and spaces for indentation in the same file.  Tabs vs. spaces is
a religious issue, but mixing the two is unquestionably bad.

    Python 3.x, finally, detects inconsistent tab/space indentation. But that
should have been in Python 0.001, so that no inconsistent code ever escaped
into the wild.

    Check to see if your code will go through Python 3.x without indentation
complaints.  If it won't, you need to fix it before re-indenting.

				John Nagle



More information about the Python-list mailing list