[Python-Dev] Naming conventions in Py3K

Michael Chermside mcherm at mcherm.com
Fri Dec 30 15:48:19 CET 2005


?!ng proposes:
> Constants in all caps:
> NONE, TRUE, FALSE, ELLIPSIS
>> Classes in initial-caps:
> Object, Int, Float, Str, Unicode, Set, List, Tuple, Dict,
> and lots of classes in the standard library, e.g.
> anydbm.error, csv.excel, imaplib.error, mutex.mutex...

(All that follows is just my opinion. Feel free to disregard.)
 1. PEP 8 is just some recommended conventions, not absolute rules.
 2. "None", "True", and "False" are the divinely inspired correct
 spellings of these objects. All caps would be incorrect.
 3. "object", "int", "float", "str", "unicode", "set", "list",
 "tuple", and "dict" all follow the common convention that the
 fundamental built-in types are in all lowercase. Note that I
 am distinguishing between built-in types and standard library
 types. I rather like this convention and would favor keeping
 it.
 4. I am a big fan of consistancy in naming. I try to follow PEP 8
 in my own code, even when I don't think it's as pretty as some
 other practice. But I just don't think the consistancy is worth
 the cost of breaking existing code. Python 3000 is ALLOWED to
 break code, but that doesn't mean it should do so gratuitously
 or break more code than necessary.
 5. For some of the classes within the standard library I'm much
 more open to being convinced. They are less often used, thus
 more suitable for a global fix-and-replace or at tweak to the
 input statements at the top of the file. Being less frequently
 used also means that consistancy in naming is more important
 because people don't necessarily use these every day.
-- Michael Chermside


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /