<div dir="ltr">On 29 July 2013 22:34, Steven D'Aprano <span dir="ltr"><<a href="mailto:steve+comp.lang.python@pearwood.info" target="_blank">steve+comp.lang.python@pearwood.info</a>></span> wrote:<br><div class="gmail_extra">

<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">On Mon, 29 Jul 2013 15:18:59 -0500, Ed Leafe wrote:<br>


<br>
> On Jul 29, 2013, at 3:08 PM, Joel Goldstick <<a href="mailto:joel.goldstick@gmail.com">joel.goldstick@gmail.com</a>><br>
> wrote:<br>
</div><div class="im">>> Not performance, but human readability<br>
><br>
</div><div class="im">>       IMO, this isn't always the case. There are many lines of code<br>
that are<br>
>       broken up to meet the 79 character limit, and as a result become<br>
much<br>
>       less readable.<br>
<br>
</div>Speaking of readability, what's with the indentation of your post? The<br>
leading tab plays havoc with my newsreader's word-wrapping.<br>
<br>
Breaking lines to fit in 79 characters should almost always be perfectly<br>
readable, if you break it at natural code units rather than at random<br>
places. E.g. I have a code snippet that looks like this:<br>
<br>
[....whatever...]<br>
else:<br>
    completer = completer.Completer(<br>
                    bindings=(r'"\C-xo": overwrite-mode',<br>
                              r'"\C-xd": dump-functions',<br>
                              )<br>
                            )<br>
<br>
I'm not entirely happy with the placement of the closing brackets, but by<br>
breaking the line at the arguments to Completer, and then putting one<br>
binding per line, I think it is perfectly readable. And much more<br>
readable than (say) this:<br>
<br>
<br>
else:<br>
    completer = completer.Completer(bindings=<br>
        (r'"\C-xo": overwrite-mode', r'"\C-xd": dump-functions',))<br></blockquote><div><br></div><div>But less readable to me than:</div><div><br></div><div>    completer = completer.Completer(bindings=[r'"\C-xo": overwrite-mode', r'"\C-xd": dump-functions'])<br>

</div><div> </div><div>Personal preference.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


As far as I can tell, that's pretty much the longest line I have in my<br>
personal code base, possibly excepting unit tests with long lists of<br>
data. I simply don't write deeply nested classes and functions unless I<br>
absolutely need to.</blockquote><div><br></div><div>I'd go for:</div><div><br></div><div><div>    completer = completer.Completer(bindings=[</div><div><span style="white-space:pre">        </span>r'"\C-xo": overwrite-mode',</div>

<div><span style="white-space:pre">        </span>r'"\C-xd": dump-functions'</div><div>    ])</div></div><div><br></div><div>although possibly drop the "bindings=" if possible. "[]" is less ambiguous a construct than "()"¹ and the "balance" of the code is better my way if such ephemeral ideas as that count.</div>

<div><br></div><div>Anyway, the point I'm trying to make is that *line length is a personal thing*. There are two rules:</div><div><br></div><div>1) Stick with what other people on the team are doing, if relevant</div>

<div>2) Don't be stupid</div><div><br></div><div>The rest is your choice. Some people like 80 character limits, but I've consistently preferred "whatever you think" as a better rule.</div><div><br></div>

<div>¹ As in there are fewer possible uses, so it's quicker to know what you're using it for</div></div></div></div>