Is PEP-8 a Code or More of a Guideline?

John J. Lee jjl at pobox.com
Wed May 30 15:57:13 EDT 2007


Steven Bethard <steven.bethard at gmail.com> writes:
> John J. Lee wrote:
[...]
> > Even as a native English speaker, some of these are tricky --
> > e.g. urllib has a private class named "addinfourl".  "What's this
> > 'fourl' we're adding in?"
> > (In fact, the method adds attributes named "info" and "url".  Even
> > though I've read that name hundreds of times, my brain always insists
> > on reading it "add in fourl".)
> > This is the worst of both worlds: inconsistent and hard to
> > understand.
> 
> Sounds like a good candidate for a rename in Python 3000.

The point was the general issue, not the particular case.  The
problems associated with this naming style do not go away when bad
cases like "addinfourl" go away:

 1. Other runtogether names are less tricky than "addinfourl", but the
    issue is still there.  These names (e.g. "getitem") are considered
    good Python standard library style.  This particular point involves
    a trade-off and is debatable, I accept.

More important, and less debatable:

 2. The runtogether style makes *many* names hard to remember because
    of the runtogether / kept_apart choice.

 3. The style introduces tiresome inconsistency in naming decisions.


John



More information about the Python-list mailing list