Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.024 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'else:': 0.03; 'broken': 0.04; 'nested': 0.07; 'arguments': 0.09; 'snippet': 0.09; 'cc:addr :python-list': 0.11; 'random': 0.14; '>>': 0.16; 'brackets,': 0.16; 'count.': 0.16; 'doing,': 0.16; 'imo,': 0.16; 'limit,': 0.16; 'readability': 0.16; 'readable': 0.16; 'rule.': 0.16; 'tab': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'uses,': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'trying': 0.19; 'fit': 0.20; 'email addr:gmail.com>': 0.22; 'preferred': 0.22; 'putting': 0.22; 'tests': 0.22; 'cc:addr:python.org': 0.22; 'case.': 0.24; 'stick': 0.24; 'mon,': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; "i've": 0.25; '>': 0.26; 'possibly': 0.26; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'rest': 0.29; 'character': 0.29; 'characters': 0.30; 'message-id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; "i'm": 0.30; 'code': 0.31; 'lines': 0.31; 'base,': 0.31; 'breaking': 0.31; "d'aprano": 0.31; 'indentation': 0.31; 'steven': 0.31; 'lists': 0.32; 'skip:c 30': 0.32; 'entirely': 0.33; 'skip:b 30': 0.33; "i'd": 0.34; 'classes': 0.35; 'possible.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'possible': 0.36; 'should': 0.36; 'unit': 0.37; 'two': 0.37; 'skip:& 10': 0.38; 'e.g.': 0.38; 'skip:[ 10': 0.38; 'pm,': 0.38; 'rather': 0.38; 'skip:& 20': 0.39; '8bit%:6': 0.40; 'skip:c 50': 0.60; 'units': 0.60; 'break': 0.61; 'length': 0.61; 'simply': 0.61; "you're": 0.61; 'personal': 0.63; 'such': 0.63; 'july': 0.63; 'for:': 0.64; 'become': 0.64; 'more': 0.64; 'natural': 0.68; 'line,': 0.68; 'deeply': 0.69; 'jul': 0.74; 'ambiguous': 0.84; 'limits,': 0.84; 'longest': 0.84; 'placement': 0.84; 'plays': 0.84; 'quicker': 0.84; 'absolutely': 0.87; '2013,': 0.91; 'joel': 0.91; 'choice.': 0.93; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=c7pLN0P/U3TzFuvpmkfGZNBNkqDUpHNlH+cRe9MqlI4=; b=ji5iPOasbDwRy0fE5/N+q2niAodTdQfnAC8P53FKHTNPu/gNRnwbhXhrSUcEPn3wnz 23UZsJNC2zLPUY6OgQ2taQzoLdhtMqTHKZetEDGglwZa9MX87rSeShimHxdFFfpHsQGA nDui8BUhKQjigl/5lnKr421bnZPwPSYzC/zniBcR0tPR05K8r7n4OPalOB3YOxxOyG/Q U/txQ1+PvQKWssyLn+qq6NCcxiweMAwWAv6LLzwNIh2HLB6GNvTmzkmG6z55MGv5QsAX HiXmeLduP0LymspodOJRsWUUPNEtyetoTbu2OvNBv4XmxiDaHrGvfpsASgtETwYJqzVb 4Exw== X-Received: by 10.112.52.97 with SMTP id s1mr26628574lbo.8.1375136719309; Mon, 29 Jul 2013 15:25:19 -0700 (PDT) MIME-Version: 1.0 Sender: joshua.landau.ws@gmail.com In-Reply-To: <51f6dff4$0$30000$c3e8da3$5496439d@news.astraweb.com> References: <51F6C5F5.5020201@Gmail.com> <51f6dff4$0$30000$c3e8da3$5496439d@news.astraweb.com> From: Joshua Landau Date: Mon, 29 Jul 2013 23:24:39 +0100 X-Google-Sender-Auth: uYo5hExIFwrhTVZza9u1MksdKz4 Subject: Re: PEP8 79 char max To: "Steven D'Aprano" Content-Type: multipart/alternative; boundary=001a11c3ecdeac158a04e2adf700 Cc: python-list X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 187 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1375137148 news.xs4all.nl 15929 [2001:888:2000:d::a6]:33973 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:51513 --001a11c3ecdeac158a04e2adf700 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 29 July 2013 22:34, Steven D'Aprano wrote: > On Mon, 29 Jul 2013 15:18:59 -0500, Ed Leafe wrote: > > > On Jul 29, 2013, at 3:08 PM, Joel Goldstick > > wrote: > >> Not performance, but human readability > > > > IMO, this isn't always the case. There are many lines of code > that are > > broken up to meet the 79 character limit, and as a result become > much > > less readable. > > Speaking of readability, what's with the indentation of your post? The > leading tab plays havoc with my newsreader's word-wrapping. > > Breaking lines to fit in 79 characters should almost always be perfectly > readable, if you break it at natural code units rather than at random > places. E.g. I have a code snippet that looks like this: > > [....whatever...] > else: > completer =3D completer.Completer( > bindings=3D(r'"\C-xo": overwrite-mode', > r'"\C-xd": dump-functions', > ) > ) > > I'm not entirely happy with the placement of the closing brackets, but by > breaking the line at the arguments to Completer, and then putting one > binding per line, I think it is perfectly readable. And much more > readable than (say) this: > > > else: > completer =3D completer.Completer(bindings=3D > (r'"\C-xo": overwrite-mode', r'"\C-xd": dump-functions',)) > But less readable to me than: completer =3D completer.Completer(bindings=3D[r'"\C-xo": overwrite-mode= ', r'"\C-xd": dump-functions']) Personal preference. As far as I can tell, that's pretty much the longest line I have in my > personal code base, possibly excepting unit tests with long lists of > data. I simply don't write deeply nested classes and functions unless I > absolutely need to. I'd go for: completer =3D completer.Completer(bindings=3D[ r'"\C-xo": overwrite-mode', r'"\C-xd": dump-functions' ]) although possibly drop the "bindings=3D" if possible. "[]" is less ambiguou= s a construct than "()"=C2=B9 and the "balance" of the code is better my way = if such ephemeral ideas as that count. Anyway, the point I'm trying to make is that *line length is a personal thing*. There are two rules: 1) Stick with what other people on the team are doing, if relevant 2) Don't be stupid The rest is your choice. Some people like 80 character limits, but I've consistently preferred "whatever you think" as a better rule. =C2=B9 As in there are fewer possible uses, so it's quicker to know what yo= u're using it for --001a11c3ecdeac158a04e2adf700 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On 29 July 2013 22:34, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote:
On Mon, 29 Ju= l 2013 15:18:59 -0500, Ed Leafe wrote:

> On Jul 29, 2013, at 3:08 PM, Joel Goldstick <joel.goldstick@gmail.com>
> wrote:
>> Not performance, but human readability
>
> =C2=A0 =C2=A0 =C2=A0 IMO, this isn't alway= s the case. There are many lines of code
that are
> =C2=A0 =C2=A0 =C2=A0 broken up to meet the 79 character limit, and as = a result become
much
> =C2=A0 =C2=A0 =C2=A0 less readable.

Speaking of readability, what's with the indentation of your post= ? The
leading tab plays havoc with my newsreader's word-wrapping.

Breaking lines to fit in 79 characters should almost always be perfectly readable, if you break it at natural code units rather than at random
places. E.g. I have a code snippet that looks like this:

[....whatever...]
else:
=C2=A0 =C2=A0 completer =3D completer.Completer(
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bindi= ngs=3D(r'"\C-xo": overwrite-mode',
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 r'"\C-xd": dump-functions'= ;,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 )
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 )

I'm not entirely happy with the placement of the closing brackets, but = by
breaking the line at the arguments to Completer, and then putting one
binding per line, I think it is perfectly readable. And much more
readable than (say) this:


else:
=C2=A0 =C2=A0 completer =3D completer.Completer(bindings=3D
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (r'"\C-xo": overwrite-mode', = r'"\C-xd": dump-functions',))

But less readable to me than:

=C2=A0 =C2= =A0 completer =3D completer.Completer(bindings=3D[r'"\C-xo": = overwrite-mode', r'"\C-xd": dump-functions'])
=C2=A0
Personal preference.

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
data. I simply don't write deeply nested classes and functions unless I=
absolutely need to.

I'd go for:

=C2=A0 =C2=A0 completer =3D completer.Completer(bind= ings=3D[
=C2=A0 r= 9;"\C-xo": overwrite-mode',
=C2=A0 r'"\C-xd&= quot;: dump-functions'
=C2=A0 =C2=A0 ])

<= /div>
although possibly drop the "bindings=3D" if possible. &= quot;[]" is less ambiguous a construct than "()"=C2=B9 and t= he "balance" of the code is better my way if such ephemeral ideas= as that count.

Anyway, the point I'm trying to make is that *line = length is a personal thing*. There are two rules:

= 1) Stick with what other people on the team are doing, if relevant
2) Don't be stupid

The rest is your choic= e. Some people like 80 character limits, but I've consistently preferre= d "whatever you think" as a better rule.

=C2=B9 As in there are fewer possible uses, so it's quicker to kno= w what you're using it for
--001a11c3ecdeac158a04e2adf700--