This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients barry, ezio.melotti, gvanrossum, lemburg, michael.foord, ncoghlan, rhettinger, serhiy.storchaka, terry.reedy
Date 2013-08-01.12:19:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1375359578.69.0.338177002419.issue18472@psf.upfronthosting.co.za>
In-reply-to
Content
Changes in version 5:

- added a new reference pointing back to this tracker issue. I figure that's a good precedent to set for future updates.
- I liked Barry's point about "Don't break backwards compatility" enough that I moved it into its own paragraph ahead of the bulleted list and changed the heading to "Some other good..."
- changed a few more cases of "rule" to "guideline"
- tabs vs spaces section now strongly prefers spaces, saying tabs should be used only for legacy compatibility reasons
- changed the line length recommendation to allow up to 99 characters when it improves readability (I kept 79 as the default recommendation, and 72 for reflowing long blocks of text)
- rewrapped my additions to the PEP at 72 chars ;)
- encodings section no longer mentions Latin-1, referring only to UTF-8, ASCII and non-ASCII.
- class based exception note changed to a recommendation to inherit from Exception (this ended up leading quite well into the comment about inheritance heirarchy design)
- we already had an admonition to avoid bare except clauses (as well as "except BaseException:")
- dropped the "highly" from the annotation decorator recommendation
- added a note that the public/internal API guideline still applies when using a wildcard import to republish APIs, as well as noting you should only use them when you don't know the list of republished names in advance

I *didn't* make any changes in relation to Barry's comment about having the commentary intermixed with the guidelines. I quite like the notion of stripping PEP 8 down to just the essentials and having PEP 108 as "The annotated PEP 8", but that's a bigger project than I'm prepared to tackle (heck, even the *current* patch turned out to be a far more substantial update than I expected!).

I'll commit this version - feel free to tweak further in the PEP repo if you spot any mistakes :)

I deliberately left the following point out since Guido said "out of scope" above (I wrote it before noticing that):

- Use an iterator or a "loop-and-a-half" construct rather than
  repeating loop setup code in the body of the loop.

  Yes::

    def itervalues(x):
        yield x.getvalue()

    for value in itervalues(obj):
        process(value)

  Yes::

    while True:
        value = obj.getvalue()
        if not value:
            break
        process(value)

  No::

    value = obj.getvalue()
    while value:
        process(value)
        value = obj.getvalue()
History
Date User Action Args
2013-08-01 12:19:39ncoghlansetrecipients: + ncoghlan, lemburg, gvanrossum, barry, rhettinger, terry.reedy, ezio.melotti, michael.foord, serhiy.storchaka
2013-08-01 12:19:38ncoghlansetmessageid: <1375359578.69.0.338177002419.issue18472@psf.upfronthosting.co.za>
2013-08-01 12:19:38ncoghlanlinkissue18472 messages
2013-08-01 12:19:38ncoghlancreate