PEP8 revised: max line lengths

Chris Angelico rosuav at gmail.com
Fri Aug 2 17:34:13 EDT 2013


On Fri, Aug 2, 2013 at 10:15 PM,  <wxjmfauth at gmail.com> wrote:
> Le vendredi 2 août 2013 17:19:11 UTC+2, Skip Montanaro a écrit :
>> > The solely valid solution, assuming there is some wish,
>> > is to define a maximal line width (preferably in SI units ;-)
>>
>> So, 79 * 8 points == 0.222955555696 meters, right? :-)
>>
>> Skip
>
> You can correct your mistake yourself. In your
> equation, the unit at the left is [1] * [point] = [point],
> at the right the unit is [meter], obviously
> [point] != [meter].

http://en.wikipedia.org/wiki/Point_(typography)

A point is one twelfth of a pica, which is one sixth of an inch, which
is 0.0254 SI millimeters. Do the arithmetic. Skip is absolutely
correct.

> Problem #1
> For a tool which is supposed to be Unicode compliant,
> a Unicode compliant font has never a constant pitch,
> so counting a maximal width in number of characters
> does not make sense.
>
> Problem #2
> The only valid constraint which makes sense is
> a maximal size in a length unit. Two possibilities:
> – if you consider your document is to be viewed
> as a screen document, pixel comes in mind.
> – if you condider your document will be printed,
> retain a physical unit length (cm, inch).
>
> Problem #3
> cm or inch? The only serious unit is an SI unit.
> (In scientific publications, only SI units are accepted)

The cm is not a primary SI unit either.

> Hint: Put you code in a pdf.

Hint: Put your code in a bitmap for screens *and* a PDF for printing.
That's the only way to guarantee that it'll work.

Since this is not possible, there is one solution left: Do not view
your code on screen, but only print it out. Then you can guarantee
that your columns are as you expected. Python could be enhanced to
take advantage of this; for instance, instead of requiring the hash
character (which may be difficult to type on certain keyboards,
including mobile phones), a letter C (U+0043) in column 1 can cause
the line to be considered a Comment.

ChrisA



More information about the Python-list mailing list