[Python-Dev] PEP 372 -- Adding an ordered directory to collections ready for pronouncement
Raymond Hettinger
python at rcn.com
Tue Mar 3 00:52:57 CET 2009
Quick question? Is PEP 8 still current for what is being done in Py3.x?
I just took a quick look and it says:
Class Names
Almost without exception, class names use the CapWords convention.
Classes for internal use have a leading underscore in addition.
----- Original Message -----
From: "Guido van Rossum" <guido at python.org>
To: "Raymond Hettinger" <python at rcn.com>
Cc: <python-dev at python.org>; "Armin Ronacher" <armin.ronacher at active-4.com>
Sent: Monday, March 02, 2009 3:38 PM
Subject: Re: [Python-Dev] PEP 372 -- Adding an ordered directory to collections ready for pronouncement
On Mon, Mar 2, 2009 at 3:13 PM, Raymond Hettinger <python at rcn.com> wrote:
>
>> Unfortunately PEP 8 never really took off naming-wise, so we're mostly
>> following
>> the "reuse the naming scheme from existing code in the same module" rule,
>> and I
>> think there lowercase wins, thanks to defaultdict.
>
> Traditionally, the all lowercase name referred to a C type. The other
> classes in
> collections are named Counter, UserDict, UserList, UserString,
> MutableMapping, etc.
> Besides, the lowercase/uppercase distinction helps us distinguish functions
> from classes.
> This is the way I've see every Python book do it since the dawn of time.
Then they're all wrong. In 3.0 we're moving away from this, e.g.
cPickle is gone, so is cStringIO. The implementation language should
not shine through. *Maybe* the "built-in status" should guide the
capitalization, so only built-in types are lowercase (str, int, dict
etc.).
Anyway, it seems the collections module in particular is already
internally inconsistent -- NamedTuple vs. defaultdict. In a sense
defaultdict is the odd one out here, since these are things you import
from some module, they're not built-in. Maybe it should be renamed to
NamedDict?
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list