[Python-Dev] PEP 8 updates/clarifications, function/method style
wolfgang.langner at googlemail.com
Thu Dec 15 11:22:13 CET 2005
>>> Too late. I don't think the diversity is all that distracting.
>> I disagree. One of the things that Java got very much right was to
>> specify, from the very beginning, what the preferred conventions are
>> for naming conventions. (Packages in lowercase, Classes in CapWords,
>> methods and variables in lowerCapWords, constants optionally in
>> ALL_CAPS. Abbrevs avoided, acronyms have all letters capitalized, eg:
>> The conventions are nearly universally followed, and as a result in
>> java I always know how to spell things. I never have to remember
>> whether it's myDict.hasKey() and myDict.popitem() or myDict.has_key()
>> and myDict.popItem(). Haskell goes too far -- they REQUIRE a certain
>> convention as part of the language... this prevents breaking the rules
>> on purpose (eg: wrapping a library from another language, or using
>> an object with attributes to represent an XML node with child nodes).
> I agree completely with this. I might remember the name of a method,
> but I don't always remember the capping and the possible use of
> underscores. Consistency would be really nice. I am not saying we
> should rename everything (at least not until Python 3 =), but at
> least we can make sure new stuff that is not preexisting can use a
> consistent naming scheme.
> And as for it being contentious, I say Guido can pronounce on this.
> We are all grown-ups and can learn to name things in a certain way to
> give our memories an easier time. =)
Same for me. Most time I can remember the name but stuck with
capping of the word. And one of the advantages of Java std lib is that naming
I hope new stuff will follow only one naming style. And now we should
(or one person :-) should) decide which one. And that's the way to go
for new stuff in std lib. And it states as an example for external modules.
As an example we can check if ElementTree matches this. <g>
For Python 3 it's possible to switch to this consistent style. For a new
and better world.
bye by Wolfgang
More information about the Python-Dev