PROPOSAL: Packages in Python lib
Paul Prescod
paul at prescod.net
Sat May 1 15:57:43 EDT 1999
I would like to suggest a package organization for the standard modules.
The package directories should all be in sys.path so that older modules
would continue to work. Import syntax could become more consistent:
from sys import types
from sys import path
This would make the shift between using the standard libraries and using
packages easier. Consistency!
Other benefits: responsibility for packages would be easier. Migration of
packages into and out of the Python standard library would be easier.
Platform unportable and implementation unportable code could be more
cleanly segmented: ("compiler" is implementation unportable, "win" is
platform unportable).
Over time, (or in the move to Python 2) these packages would migrate to
real, cohesive packages with consistent internal interfaces (i.e. among
formats and protocols) and some consistent interfaces at the package level
(e.g. __all__)
Main benefit: It would be easier to find things in the standard library
and to document the library!
Downsides:
* slightly more typing on import.
Here is a rough example of what I am thinking of:
sys:
except
traceback
types
string:
string
re
compiler:
token.
tokenize
compileall
database:
*dbm
*SQL
formats:
xdrlib
xmllib
rfc822
zlib
...
Math:
whrandom
time
cmath
Data Structures:
UserDict
UserList
array
Unix:
SGI:
al
...
SunOS:
...
Windows:
...
Reflect:
code
commands
Protocols:
urllib
urlparse
gopherlib
htmllib
httplib
telnetlib
Server:
BaseHTTPServer
cgi
Misc:
Bastion
fileinput
Thread:
thread
threading
OS:
tempfile
cmd
Serial:
pickle
cpickle
...
Crypt:
...
Old:
regex
--
Paul Prescod - ISOGEN Consulting Engineer speaking for only himself
http://itrc.uwaterloo.ca/~papresco
"Microsoft spokesman Ian Hatton admits that the Linux system would have
performed better had it been tuned."
"Future press releases on the issue will clearly state that the research
was sponsored by Microsoft."
http://www.itweb.co.za/sections/enterprise/1999/9904221410.asp
More information about the Python-list
mailing list