PEP8 79 char max

Joshua Landau joshua at landau.ws
Mon Jul 29 22:12:29 EDT 2013


On 30 July 2013 01:41, Rhodri James <rhodri at wildebst.demon.co.uk> wrote:

> On Tue, 30 Jul 2013 01:11:18 +0100, Joshua Landau <joshua at landau.ws>
> wrote:
>
>  On 30 July 2013 00:08, Rhodri James <rhodri at wildebst.demon.co.uk> wrote:
>>
>>> I'm working on some shonky C code at the moment that inconsistent
>>> indentation and very long lines.  It is extremely annoying not to be
>>> able to put the original code, my "translation" and sundry utilities
>>> all side-by-side on the same screen (and it's not a particularly
>>> small screen), and having to keep flipping between them slows me
>>> down dramatically.   Long lines have no effect on the speed of the
>>> program, but they can have serious effects on the speed of the
>>> programmer.
>>>
>>
>> Then just wrap it. This is a very automatable thing for editors. There
>> might even be a clever hard-wrap somewhere. I just tried pyformat -- that
>> works wonders.
>>
>
> I tried that at first, but it actually made matters worse.  "Simple"
> word-wrapping just broke the structural cues from indentation (which I'd
> already had to instruct my editor to make at least somewhat consistent).  I
> couldn't just take in the code layout at a glance, I had to work at it.


1) pyformat's quite sane, maybe you should try that. It's a few minutes
wasted at worst. (sudo pip install pyformat; pyformat <infile> [-i for
inplace changes])

2) How does your soft word-wrap work? I know some editors do it terribly,
mine does it passably¹. I don't know any that do it truly semantically
(although it's a feature worthy of implementation).

3) Is the code secret? Let's see a "difficult" snippet if not.

¹ It either indents to the same indentation as the line's start or an extra
indent inwards, depending on context
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130730/2ce2bc90/attachment.html>


More information about the Python-list mailing list