PEP 8 : Maximum line Length :

Marko Rauhamaa marko at pacujo.net
Fri May 16 05:18:16 EDT 2014


Chris Angelico <rosuav at gmail.com>:

> You still haven't answered my biggest objection from earlier. Source
> code contains more information than the AST does; even if you make a
> frAnkenSTein's monster that includes comments, there's still the point
> that whitespace carries information, and that information is
> frequently communicative of the programmer's intent. Any automated
> reformatter destroys that information, and that is, by definition, a
> net loss to the code. How do you propose to fix that? Or if not, will
> you at least acknowledge that the AST cannot perfectly transmit what
> the source code says?

If every bit of your Python text conveys information, obviously, it
can't be abstracted. I don't believe that to be the case, though. So
this AST should contain all *actual* information worth conveying and
strip away irrelevant stuff.

Examples:

 * Function definition order.

 * Indentation depth.

 * Vertical empty space.


Of course, I'm not being completely serious about all this stuff because
the surface coding style questions are among the least relevant problems
in the code. But at least that kind of arrangement would free us from
the heated debates concerning the maximum line length etc.

(BTW, regardless of PEP8, the maximum line length *must* be 79, and the
maximum function length *must* be whatever can be seen on the screen at
once.)


Marko



More information about the Python-list mailing list