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

Paul McGuire ptmcg at austin.rr.com
Sun May 27 04:25:38 EDT 2007


On May 27, 1:25 am, Steven Bethard <steven.beth... at gmail.com> wrote:
> Stefan Sonnenberg-Carstens wrote:
> > Paul McGuire schrieb:
> >> I'm starting a new thread for this topic, so as not to hijack the one
> >> started by Steve Howell's excellent post titled "ten small Python
> >> programs".
>
> >> In that thread, there was a suggestion that these examples should
> >> conform to PEP-8's style recommendations, including use of
> >> lower_case_with_underscores style for function names.  I raised some
> >> questions about this suggestion, since I liked the names the way they
> >> were, but as a result, part of the discussion has drifted into a
> >> separate track about PEP-8, and naming styles.
>
> > I prefer mixedCaseStyle, and I think that should be "standard", as this
> > style is commonly
> > used in all "major" languages , for example Java,C++,C#.
> > It shortens the identifiers but leaves the meaning intact.
>
> The argument for under_score_names is usually that non-native speakers
> can more easily find the word boundaries. Not being a non-native speaker
> ;-) I can't verify that one, but it's pretty plausible given the current
> amount of money spent on research on automatic word-segmentation for
> languages like Chinese. =)
>
> STeVe- Hide quoted text -
>
> - Show quoted text -

Here is the thread from python-dev where this change (from "mixedCase
is no better or worse than lower_case_with_underscores" to "should use
l_c_w_u") was discussed, a year ago last December:

http://mail.python.org/pipermail/python-dev/2005-December/058750.html

At first, Guido seemed ambivalent, and commented on the
contentiousness of the issue, but it seems that the "non-English
speakers can more easily find word breaks marked with underscores"
justification tipped the scale in favor of
lower_case_with_underscores.

The PEP itself on www.python.org seems to have been updated as
recently as May 17 of this year, but I don't seen any way to identify
what the change history is.

So, those who are the stewards of the core source code have nailed
down thier coding standard to be l_c_w_u, so if sometime in the future
I find myself working on any code in the Python std libs, l_c_w_u is
the style to be followed.  It just looks so old-fashioned...

Whatev.

-- Paul




More information about the Python-list mailing list