[Python-3000] stdlib reorganization

Talin talin at acm.org
Tue May 30 05:51:02 CEST 2006


Guido van Rossum wrote:
> I have to ignore this topic. It's too big and contentious to get easy
> agreement. (The one thing I *don't* want is move the entire stdlib
> hierarchy under 'py' or something like that.) Eric Raymond once made
> detailed proposal, you can probably still find it somewhere. Good
> luck!
> 

Well, it looks like it wasn't that contentious after all :)

Actually, I'm kind of surprised that there wasn't more comments on this. 
Part of my purpose in posting a strawman proposal was to generate 
discussion, and from that discussion see if I could derive a set of 
guidelines or principles that could be used to generate a more serious 
proposal. So in a sense my posting was a trojan horse intended to gather 
data; Perhaps everyone was smart enough to see through this strategem 
and decline to comment. :)

Looking over the general Py3K roadmap, and ignoring various wild-eyed 
proposals for new features (my own included), it seems to me that the 
two biggest areas of cruft cleanup that have not been fully addressed 
are 1) the organization of the standard library, and 2) The refactoring 
of the import/package facility. I'm not really interested in creating 
proposals for either of these, what I am more interested in is 
organizing other people's proposals and in particular resolving 
conflicts (which is effectively what I am trying to do with 3101.)

-- Talin

>> 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