[Python-3000] stdlib reorganization
Talin
talin at acm.org
Tue May 23 08:54:14 CEST 2006
Guido van Rossum wrote:
> On 5/22/06, Antoine Pitrou <solipsis at pitrou.net> wrote:
>
>>Yet "array" is not named "arraylib", "calendar" is not named
>>"calendarlib", "email" is not named "emaillib"... Shall I continue? ;)
>
>
> Please stop this pointless debate. We all know that the stdlib uses
> many different inconsistent naming conventions. And I admit full
> responsibility for many of those.
>
> If you want to do something about it, come up with a consistent naming
> convention.
Well, in that case, let me ask this: What would be the general
parameters / requirements of the re-organization? I mean, any programmer
can come along and divide up things into categories, but I suspect that
there are subtler requirements than that.
Here are some examples of some requirements that I can think of:
1) No mass renaming of modules unless there's something seriously wrong
with the existing name.
2) For most cases, I suspect that you will want to add no more than one
additional level to the hierarchy. Namespaces will still be fairly flat,
with large numbers of items per namespace, but not quite as broad and
flat as they are today. (In other words, avoid deep nesting - we don't
want to have to type sys.runtime.types.containers.UserDict.UserDict.)
So that people will have something to argue about, I'd suggest the
following as a top-level category list. Note that only a small amount of
thought has gone into this :)
sys - contains the existing sys, plus atexit, site, user, etc.
rt - runtime modules - gc, fpectl, inspect, etc.
types - existing types module, mixin types, type predicates.
persist - marshall, pickle, shelve, etc. Possibly zip and
maybe ConfigParser
imp - import machinery - existing imp, zipimport, pkgutil,
modulefinder
string - existing string, plus repr, pprint, textwrap, stringprep.
Possibly fnmatch.
encoding - codecs, unicodedata
Example: net.protocols.http
conversions - data conversion modules - fpformat
re - regular expressions - unchanged
collection - existing collections, queue, heapq, array
Example: collections.array.array
algorithms - diff, random, whrandom
testing - doctest, unittest, test, test_support
math - existing math, decimal, cmath
Example: math.decimal
doc - documentation tools - pydoc
itertools - unchanged
functional - unchanged
console - cmd, shlex, curses*, getopt, optparse, readline,
rlcompleter
os - existing os plus errno
os.path - as-is
os.file - existing os.file plus fileinput, tempfile, filecmp,
mmap
os.dir - existing os.dir plus dircache, stat*, glob, shutil
os.stream - popen*
os.process - subprocess, signal
os.socket - existing socket, select
os.thread - existing threading, mutex
os.posix - posix-specific
os.win32 - win32-specific
os.osx - osx-specific
locale - unchanged
logging - unchanged
platform - unchanged
compression - zlib, gzip, bz2, etc. (Or perhaps an 'archive'
module including 'tar'.)
db - database packages - the various databases, gdbm, bsddb, etc.
debug - pdb, bdb, etc.
profile - profiler, hotshot, etc.
net.protocols - http, imap, pop, ftp, etc.
Example: net.protocols.http
net.formats - mail, mime, binhex, etc.
Example: net.formats.mime
net.tools - webbrowser, SocketServer, robotparser, etc.
xml.* - xml-related packages
Example: xml.sax
media.audio - audio packages
media.image - image conversion packages
rexec - rename to 'restrict' (Too much confusion with 'regex')
python - python language services (compiler, parser, etc.)
-- Talin
More information about the Python-3000
mailing list