Great Renaming - Straw Man 0.2
Here's a second version of the straw man proposal for the reorganization
of modules in packages. Note that I'm treating it as a strictly 1.7
proposal, so I don't care a "lot" about backwards compatiblity.
I'm down to 4 unhandled modules, which means that if no one objects (and
I'm sure someone will <wink>), this can be a plan of action. So get your
objections ready guys!
net
httplib
ftplib
urllib
cgi
gopherlib
imaplib
poplib
nntplib
smptlib
urlparse
telnetlib
server
BaseHTTPServer
CGIHTTPServer
SimpleHTTPServer
SocketServer
asynchat
asyncore
text
sgmllib
htmllib
htmlentitydefs
xml
whatever the xml-sig puts here
mail
rfc822
mime
MimeWriter
mimetools
mimify
mailcap
mimetypes
base64
quopri
mailbox
mhlib
binhex
parse
string
re
regex
reconvert
regex_syntax
regsub
shlex
ConfigParser
linecache
multifile
netrc
bin
gzip
zlib
aifc
chunk
image
imghdr
colorsys
imageop
imgfile
rgbimg
yuvconvert
sound
sndhdr
toaiff
audiodev
sunau
sunaudio
wave
audioop
sunaudiodev
db
anydbm
whichdb
bsddb
dbm
dbhash
dumbdbm
gdbm
math
bisect
fpformat
random
whrandom
cmath
math
crypt
fpectl
fpetest
array
md5
mpz
rotor
sha
time
calendar
time
tzparse
sched
timing
interpreter
new
py_compile
code
codeop
compileall
keyword
token
tokenize
parser
dis
bdb
pdb
profile
pyclbr
tabnanny
symbol
pstats
traceback
rlcompleter
security
Bastion
rexec
ihooks
file
dircache
path -- a virtual module which would do a from <something>path import *
dospath
posixpath
macpath
nturl2path
ntpath
macurl2path
filecmp
fileinput
StringIO
cStringIO
glob
fnmatch
posixfile
stat
statcache
statvfs
tempfile
shutil
pipes
popen2
commands
dl
fcntl
lowlevel
socket
select
terminal
termios
pty
tty
readline
syslog
serialize
pickle
cPickle
shelve
xdrlib
copy
copy_reg
threads
thread
threading
Queue
mutex
ui
curses
Tkinter
cmd
getpass
internal
_codecs
_locale
_tkinter
pcre
strop
posix
users
pwd
grp
nis
sgi
al
cd
cl
fl
fm
gl
misc (what used to be sgimodule.c)
sv
unicode
codecs
unicodedata
unicodedatabase
exceptions
os
types
UserDict
UserList
user
site
locale
pure
formatter
getopt
signal
pprint
========== Modules not handled ============
errno
resource
operator
struct
--
Moshe Zadka
On Sun, 26 Mar 2000, Moshe Zadka wrote:
Here's a second version of the straw man proposal for the reorganization of modules in packages. Note that I'm treating it as a strictly 1.7 proposal, so I don't care a "lot" about backwards compatiblity.
Hey, this looks pretty good. For the most part i agree with your layout. Here are a few notes...
net [...] server [...]
Good.
text [...] xml whatever the xml-sig puts here mail rfc822 mime MimeWriter mimetools mimify mailcap mimetypes base64 quopri mailbox mhlib binhex
I'm not convinced "mime" needs a separate branch here. (This is the deepest part of the tree, and at three levels small alarm bells went off in my head.) For example, why text.binhex but text.mail.mime.base64?
parse string re regex reconvert regex_syntax regsub shlex ConfigParser linecache multifile netrc
The "re" module, in particular, will get used a lot, and it's not clear why these all belong under "parse". I suggest dropping "parse" and moving these up. What's "multifile" doing here instead of with the rest of the mail/mime stuff?
bin [...]
I like this. Good idea.
gzip zlib aifc
Shouldn't "aifc" be under "sound"?
image [...] sound [...]
db [...]
Yup.
math [...] time [...]
Looks good.
interpreter [...]
How about just "interp"?
security [...]
file [...] lowlevel socket select
Why the separate "lowlevel" branch? Why doesn't "socket" go under "net"?
terminal termios pty tty readline
Why does "terminal" belong under "file"? Maybe it could go under "ui"? Hmm... "pty" doesn't really belong.
syslog
Hmm...
serialize
pickle cPickle shelve xdrlib copy copy_reg
"copy" doesn't really fit here under "serialize", and "serialize" is kind of a long name. How about a "data types" package? We could then put "struct", "UserDict", "UserList", "pprint", and "repr" here. data copy copy_reg pickle cPickle shelve xdrlib struct UserDict UserList pprint repr On second thought, maybe "struct" fits better under "bin".
threads [...] ui [...]
Uh huh.
internal _codecs _locale _tkinter pcre strop posix
Not sure this is a good idea. It means the Unicode work lives under both "unicode" and "internal._codecs", Tk is split between "ui" and "internal._tkinter", regular expressions are split between "text.re" and "internal.pcre". I can see your motivation for getting "posix" out of the way, but i suspect this is likely to confuse people.
users pwd grp nis
Hmm. Yes, i suppose so.
sgi [...] unicode [...]
Indeed.
os UserDict UserList exceptions types operator user site
Yeah, these are all top-level (except maybe UserDict and UserList, see above).
locale
I think "locale" belongs under "math" with "fpformat" and the others. It's for numeric formatting.
pure
What the heck is "pure"?
formatter
This probably goes under "text".
struct
See above under "data". I can't decide whether "struct" should be part of "data" or "bin". Hmm... probably "bin" -- since, unlike the serializers under "data", "struct" does not actually specify a serialization format, it only provides fairly low-level operations. Well, this leaves a few system-like modules that didn't really fit elsewhere for me: pty tty termios syslog select getopt signal errno resource They all seem to be Unix-related. How about putting these in a "unix" or "system" package? -- ?!ng "I'm not trying not to answer the question; i'm just not answering it." -- Lenore Snell
On Sat, 25 Mar 2000, Ka-Ping Yee wrote:
I'm not convinced "mime" needs a separate branch here. (This is the deepest part of the tree, and at three levels small alarm bells went off in my head.)
I've had my problems with that too, but it seemed to many modules were mime specific.
For example, why text.binhex but text.mail.mime.base64?
Actually, I thought about this (this isn't random at all): base64 encoding is part of the mime standard, together with quoted-printable. Binhex isn't. I don't know if you find it reason enough, and it may be smarter just having a text.encode.{quopri,uu,base64,binhex}
parse string re regex reconvert regex_syntax regsub shlex ConfigParser linecache multifile netrc
The "re" module, in particular, will get used a lot,
and from <something> import re Doesn't seem too painful.
and it's not clear why these all belong under "parse".
These are all used for parsing data (which does not have some pre-written parser). I had problems with the name too...
What's "multifile" doing here instead of with the rest of the mail/mime stuff?
It's also useful generally.
Shouldn't "aifc" be under "sound"?
You're right.
interpreter [...]
How about just "interp"?
I've no *strong* feelings, just a vague "don't abbrev." hunch <wink>
Why the separate "lowlevel" branch?
Because it is -- most Python code will use one of the higher level modules.
Why doesn't "socket" go under "net"?
What about UNIX domain sockets? Again, no *strong* opinion, though.
terminal termios pty tty readline
Why does "terminal" belong under "file"?
Because it is (a special kind of file)
serialize
pickle cPickle shelve xdrlib copy copy_reg
"copy" doesn't really fit here under "serialize", and "serialize" is kind of a long name.
I beg to disagree -- "copy" is frequently close to serialization, both in the model (serializing to a "data structure") and in real life (that's the way people copy stuff in Java, and UNIX too: think tar cvf - | tar xvf -) What's more, copy_reg is used both for copy and for pickle I do like the idea of "data-types" package, but it needs to be ironed out a bit.
internal _codecs _locale _tkinter pcre strop posix
Not sure this is a good idea. It means the Unicode work lives under both "unicode" and "internal._codecs", Tk is split between "ui" and "internal._tkinter", regular expressions are split between "text.re" and "internal.pcre". I can see your motivation for getting "posix" out of the way, but i suspect this is likely to confuse people.
You mistook my motivation -- I just want unadvertised modules (AKA internal use modules) to live in a carefully segregate section of the namespace. How would this confuse people? No one imports _tkinter or pcre, so no one would notice the change.
locale
I think "locale" belongs under "math" with "fpformat" and the others. It's for numeric formatting.
Only? And anyway, I doubt many people will think like that.
pure
What the heck is "pure"?
A module that helps work with purify.
formatter
This probably goes under "text".
You're right.
Well, this leaves a few system-like modules that didn't really fit elsewhere for me:
pty tty termios syslog select getopt signal errno resource
They all seem to be Unix-related. How about putting these in a "unix" or "system" package?
"select", "signal" aren't UNIX specific.
"getopt" is used for generic argument processing, so it isn't really UNIX
specific. And I don't like the name "system" either. But I have no
constructive proposals about thos either.
so-i'll-just-shut-up-now-ly y'rs, Z.
--
Moshe Zadka
"select", "signal" aren't UNIX specific. Huh? How not? Can you name a non-UNIX that is providing them? (BeOS wouldn't count, select is broken, and nobody uses signals.) and if you can, is it providing them for something other than "UNIX/POSIX compatibility" "getopt" is used for generic argument processing, so it isn't really UNIX specific.
It's a POSIX.2 function. I consider that UNIX.
And I don't like the name "system" either. But I have no constructive proposals about thos either.
so-i'll-just-shut-up-now-ly y'rs, Z. -- just-picking-nits-ly y'rs, Dan
On Sat, 25 Mar 2000, Daniel Berlin wrote:
"select", "signal" aren't UNIX specific. Huh? How not? Can you name a non-UNIX that is providing them?
Win32. Both of them. I've even used select there.
and if you can, is it providing them for something other than "UNIX/POSIX compatibility"
I don't know what it provides them for, but I've *used* *select* on *WinNT*. I don't see why Python should make me feel bad when I'm doing that.
"getopt" is used for generic argument processing, so it isn't really UNIX specific.
It's a POSIX.2 function. I consider that UNIX.
Well, the argument style it processes is not unheard of in other OSes, and
it's nice to have command line apps that have a common ui. That's it!
"getopt" belongs in the ui package!
--
Moshe Zadka
On Sun, 26 Mar 2000, Moshe Zadka wrote:
For example, why text.binhex but text.mail.mime.base64?
Actually, I thought about this (this isn't random at all): base64 encoding is part of the mime standard, together with quoted-printable. Binhex isn't. I don't know if you find it reason enough, and it may be smarter just having a text.encode.{quopri,uu,base64,binhex}
I think i'd like that better, yes.
and it's not clear why these all belong under "parse".
These are all used for parsing data (which does not have some pre-written parser). I had problems with the name too...
And parsing is what the "text" package is about anyway. I say move them up. (See the layout in my other message. Notice most of the regular-expression stuff is deprecated anyway, so it's not like there are really that many.)
Why doesn't "socket" go under "net"?
What about UNIX domain sockets? Again, no *strong* opinion, though.
Bleck, you're right. Well, i think we just have to pick one or the other here, and i think most people would guess "net" first. (You can think of it as IPC, and file IPC-related things under then "net" category...?)
Why does "terminal" belong under "file"?
Because it is (a special kind of file)
Only in Unix. It's Unix that likes to think of all things, including terminals, as files.
I do like the idea of "data-types" package, but it needs to be ironed out a bit.
See my other message for a possible suggested hierarchy...
internal [...] You mistook my motivation -- I just want unadvertised modules (AKA internal use modules) to live in a carefully segregate section of the namespace. How would this confuse people? No one imports _tkinter or pcre, so no one would notice the change.
I think it makes more sense to classify modules by their topic rather than their exposure. (For example, you wouldn't move deprecated modules to a "deprecated" package.) Keep in mind that (well, at least to me) the main point of any naming hierarchy is to avoid name collisions. "internal" doesn't really help that purpose. You also want to be sure (or as sure as you can) that modules will be obvious to find in the hierarchy. An "internal" package creates a distinction orthogonal to the topic-matter distinction we're using for the rest of the packages, which *potentially* introduces the question "well... is this module internal or not?" for every other module. Yes, admittedly this is only "potentially", but i hope you see the abstract point i'm trying to make...
locale
I think "locale" belongs under "math" with "fpformat" and the others. It's for numeric formatting.
Only? And anyway, I doubt many people will think like that.
Yeah, it is pretty much only for numeric formatting. The more generic locale stuff seems to be in _locale.
They all seem to be Unix-related. How about putting these in a "unix" or "system" package?
"select", "signal" aren't UNIX specific.
Yes, but when they're available on other systems they're an attempt to emulate Unix or Posix functionality, aren't they?
Well, the argument style it processes is not unheard of in other OSes, and it's nice to have command line apps that have a common ui. That's it! "getopt" belongs in the ui package!
I like ui.getopt. It's a pretty good idea. -- ?!ng "I'm not trying not to answer the question; i'm just not answering it." -- Lenore Snell
On Sat, 25 Mar 2000, Ka-Ping Yee wrote:
"select", "signal" aren't UNIX specific.
Yes, but when they're available on other systems they're an attempt to emulate Unix or Posix functionality, aren't they?
I thinki "signal" is ANSI C, but I'm not sure. no-other-comments-ly y'rs, Z.
Responding to an early item in this thread and trying to adapt to later items... Ping wrote: I'm not convinced "mime" needs a separate branch here. (This is the deepest part of the tree, and at three levels small alarm bells went off in my head.) It's not clear that mime should be beneath text/mail. Moshe moved it up a level, but not the way I would have done it. I think the mime stuff still belongs in a separate mime package. I wouldn't just sprinkle the modules under text. I see two possibilities: text>mime net>mime I prefer net>mime, because MIME and its artifacts are used heavily in networked applications where the content being transferred isn't text. -- Skip Montanaro | http://www.mojam.com/ skip@mojam.com | http://www.musi-cal.com/
On Mon, 27 Mar 2000, Skip Montanaro wrote:
Responding to an early item in this thread and trying to adapt to later items...
Ping wrote:
I'm not convinced "mime" needs a separate branch here. (This is the deepest part of the tree, and at three levels small alarm bells went off in my head.)
It's not clear that mime should be beneath text/mail. Moshe moved it up a level,
Actually, Ping moved it up a level. I only decided to agree with him retroactively...
I think the mime stuff still belongs in a separate mime package. I wouldn't just sprinkle the modules under text. I see two possibilities:
text>mime net>mime
I prefer net>mime,
I don't. MIME is not a "wire protocol" like all the other things in net --
it's used inside another wire protocol, like RFC822 or HTTP. If at all,
I'd go for having a
net/
mail/
mime/
Package, but Ping would yell at me again for nesting 3 levels.
I could live with text/mime, because the mime format basically *is* text.
--
Moshe Zadka
Okay, here's another shot at it. Notice a few things: - no text.mime package - encoders moved to text.encode - Unix stuff moved to unix package (no file.lowlevel, file.terminal) - aifc moved to bin.sound package - struct moved to bin package - locale moved to math package - linecache moved to interp package - data-type stuff moved to data package - modules in internal package moved to live with their friends Modules that are deprecated or not really intended to be imported are listed in parentheses (to give a better idea of the "real" size of each package). cStringIO and cPickle are parenthesized in hopeful anticipation of agreement on my last message... net urlparse urllib ftplib gopherlib imaplib poplib nntplib smtplib telnetlib httplib cgi server BaseHTTPServer CGIHTTPServer SimpleHTTPServer SocketServer asynchat asyncore text re # general-purpose parsing sgmllib htmllib htmlentitydefs xml whatever the xml-sig puts here mail rfc822 mailbox mhlib encode # i'm also ok with moving text.encode.* to text.* binhex uu base64 quopri MimeWriter mimify mimetools mimetypes multifile mailcap # special-purpose file parsing shlex ConfigParser netrc formatter (string, strop, pcre, reconvert, regex, regex_syntax, regsub) bin gzip zlib chunk struct image imghdr colorsys # a bit unsure, but doesn't go anywhere else imageop imgfile rgbimg yuvconvert sound aifc sndhdr toaiff audiodev sunau sunaudio wave audioop sunaudiodev db anydbm whichdb bsddb dbm dbhash dumbdbm gdbm math math # library functions cmath fpectl # type-related fpetest array mpz fpformat # formatting locale bisect # algorithm: also unsure, but doesn't go anywhere else random # randomness whrandom crypt # cryptography md5 rotor sha time calendar time tzparse sched timing interp new linecache # handling .py files py_compile code # manipulating internal objects codeop dis traceback compileall keyword # interpreter constants token symbol tokenize # parsing parser bdb # development pdb profile pyclbr tabnanny pstats rlcompleter # this might go in "ui"... security Bastion rexec ihooks file dircache path -- a virtual module which would do a from <something>path import * nturl2path macurl2path filecmp fileinput StringIO glob fnmatch stat statcache statvfs tempfile shutil pipes popen2 commands dl (dospath, posixpath, macpath, ntpath, cStringIO) data pickle shelve xdrlib copy copy_reg UserDict UserList pprint repr (cPickle) threads thread threading Queue mutex ui _tkinter curses Tkinter cmd getpass getopt readline users pwd grp nis sgi al cd cl fl fm gl misc (what used to be sgimodule.c) sv unicode _codecs codecs unicodedata unicodedatabase unix errno resource signal posix posixfile socket select syslog fcntl termios pty tty _locale exceptions sys os types user site pure operator -- ?!ng "I'm not trying not to answer the question; i'm just not answering it." -- Lenore Snell
Hey, while we're at it... as long as we're renaming modules, what do you all think of getting rid of that "lib" suffix? As in:
net urlparse url ftp gopher imap pop nntp smtp telnet http cgi server [...] text re # general-purpose parsing sgml html htmlentitydefs [...]
"import net.ftp" seems nicer to me than "import ftplib". We could also just stick htmlentitydefs.entitydefs in html and deprecate htmlentitydefs. -- ?!ng "I'm not trying not to answer the question; i'm just not answering it." -- Lenore Snell
On Sat, 25 Mar 2000, Ka-Ping Yee wrote:
Hey, while we're at it... as long as we're renaming modules, what do you all think of getting rid of that "lib" suffix?
+0
--
Moshe Zadka
+1. I've had minor nits, but nothing is perfect, and this is definitely
"good enough".
Now we'll just have to wait until the BDFL says something...
--
Moshe Zadka
On 25 March 2000, Ka-Ping Yee said:
Okay, here's another shot at it. Notice a few things:
Damn, I started writing a response to Moshe's original proposal -- and *then* saw this massive thread. Oh well. Turns out I still have a few useful things to say: First, any organization scheme for the standard library (or anything else, for that matter) should have a few simple guidelines. Here are two: * "deep hierarchies considered harmful": ie. avoid sub-packages if at all possible * "everything should have a purpose": every top-level package should be describable with a single, clear sentence of plain language. Eg.: net - Internet protocols, data formats, and client/server infrastructure unix - Unix-specific system calls, protocols, and conventions And two somewhat open issues: * "as long as we're renaming...": maybe this would be a good time to standardize naming conventions, eg. "cgi" -> "cgilib" *or* "{http,ftp,url,...}lib" -> "{http,ftp,url}...", "MimeWriter" -> "mimewriter", etc. * "shared namespaces vs system namespaces": the Perl model of "nothing belongs to The System; anyone can add a module in Text:: or Net:: or whatever" works there because Perl doesn't have __init__ files or anything to distinguish module namespaces; they just are. Python's import mechanism would have to change to support this, and the fact that __init__ files may contain arbitrary code makes this feel like a very tricky change to make. Now specific comments...
net urlparse urllib ftplib gopherlib imaplib poplib nntplib smtplib telnetlib httplib cgi
Rename? Either cgi -> cgilib or foolib -> foo?
server BaseHTTPServer CGIHTTPServer SimpleHTTPServer SocketServer asynchat asyncore
This is one good place for a sub-package. It's a also a good place to rename: the convention for Python module names seems to be all-lowercase; and "Server" is redundant when you're in the net.server package. How about: net.server.base_http net.server.cgi_http net.server.simple_http net.server.socket Underscores negotiable. They don't seem to be popular in module names, although sometimes they would be real life-savers.
text
I think "text" should mean "plain old unstructured, un-marked-up ASCII text", where "unstructured, un-marked-up" really means "not structured or marked up in a well-known standard way". Or maybe not. I'm just trying to come up with an excuse for moving xml to top-level, which I think is where it belongs. Maybe the excuse should just be, "XML is really important and visible, and anyways Paul Prescod will raise a stink if it isn't put at top-level in Python package-space".
re # general-purpose parsing
Top-level: this is a fundamental module that should be treated on a par with 'string'. (Well, except for building RE methods into strings... hmmMMmm...maybe... [no, I'm kidding!])
sgmllib htmllib htmlentitydefs
Not sure what to do about these. Someone referred somewhere to a "web" top-level package, which seems to have disappeared. If it reappars, it would be a good place for the HTML modules (not to mention a big chunk of "net") -- this would mainly be for "important and visible" (ie. PR) reasons, rather than sound technical reasons.
xml whatever the xml-sig puts here
Should be top-level.
mail rfc822 mailbox mhlib
"mail" should either be top-level or under "net". (Yes, I *know* it's not a wire-level protocol: that's what net.smtplib is for. But last time I checked, email is pretty useless without a network. And vice-versa.) Or maybe these all belong in a top-level "data" package: I'm starting to warm to that.
bin gzip zlib chunk struct image imghdr colorsys # a bit unsure, but doesn't go anywhere else imageop imgfile rgbimg yuvconvert sound aifc sndhdr toaiff audiodev sunau sunaudio wave audioop sunaudiodev
I agree with Jack: image and sound (audio?) should be top-level. I don't think I like the idea of an intervening "mm" or "multimedia" or "media" or what-have-you package, though. The other stuff in "bin" is kind of a grab-bag: "chunk" and "struct" might belong in the mythical "data" package.
db anydbm whichdb bsddb dbm dbhash dumbdbm gdbm
Yup.
math math # library functions cmath fpectl # type-related fpetest array mpz fpformat # formatting locale bisect # algorithm: also unsure, but doesn't go anywhere else random # randomness whrandom crypt # cryptography md5 rotor sha
Hmmm. "locale" has already been dealt with; obviously it should be top-evel. I think "array" should be top-level or under the mythical "data". Six crypto-related modules seems like enough to justify a top-level "crypt" package, though.
time calendar time tzparse sched timing
Yup.
interp new linecache # handling .py files [...] tabnanny pstats rlcompleter # this might go in "ui"...
I like "python" for this one. (But I'm not sure if tabnanny and rlcompleter belong there.)
security Bastion rexec ihooks
What does ihooks have to do with security?
file dircache path -- a virtual module which would do a from <something>path import * nturl2path macurl2path filecmp fileinput StringIO
Lowercase for consistency?
glob fnmatch stat statcache statvfs tempfile shutil pipes popen2 commands dl
No problem until these last two -- 'commands' is a Unix-specific thing that has very little to do with the filesystem per se, and 'dl' is (as I understand it) deep ju-ju with sharp edges that should probably be hidden away in the 'python' ('sys'?) package. Oh yeah, "dl" should be elsewhere -- "python" maybe? Top-level? Perhaps we need a "deepmagic" package for "dl" and "new"? ;-)
data pickle shelve xdrlib copy copy_reg UserDict UserList pprint repr (cPickle)
Oh hey, it's *not* a mythical package! Guess I didn't read far enough ahead. I like it, but would add more stuff to it (obviously): 'struct', 'chunk', 'array' for starters. Should cPickle be renamed to fastpickle?
threads thread threading Queue
Lowercase?
ui _tkinter curses Tkinter cmd getpass getopt readline
users pwd grp nis
These belong in "unix". Possibly "nis" belongs in "net" -- do any non-Unix OSes use NIS?
sgi al cd cl fl fm gl misc (what used to be sgimodule.c) sv
Should this be "sgi" or "irix"? Ditto for "sun" vs "solaris" if there are a significant number of Sun/Solaris modules. Note that the respective trademark holders might get very antsy about who gets to put names in those namespaces -- that's exactly what happened with Sun, Solaris 8, and Perl. I believe the compromise they arrived at was that the "Solaris::" namespace remains open, but Sun gets the "Sun::" namespace. There should probably be a win32 package, for core registry access stuff if nothing else. There might someday be a "linux" package; it's highly unlikely there would be a "pc" or "alpha" package though. All of those argue over "irix" and "solaris" instead of "sgi" and "sun". Greg
On Tue, 28 Mar 2000, Greg Ward wrote:
* "deep hierarchies considered harmful": ie. avoid sub-packages if at all possible
* "everything should have a purpose": every top-level package should be describable with a single, clear sentence of plain language.
Good guidelines, but they aren't enough. And anyway, rules were meant to be broken <0.9 wink>
* "as long as we're renaming...": maybe this would be a good time to standardize naming conventions, eg. "cgi" -> "cgilib" *or* "{http,ftp,url,...}lib" -> "{http,ftp,url}...", "MimeWriter" -> "mimewriter", etc.
+1
* "shared namespaces vs system namespaces": the Perl model of "nothing belongs to The System; anyone can add a module in Text:: or Net:: or whatever" works there because Perl doesn't have __init__ files or anything to distinguish module namespaces; they just are. Python's import mechanism would have to change to support this, and the fact that __init__ files may contain arbitrary code makes this feel like a very tricky change to make.
Indeed. But I still feel that "few things should belong to the system" is quite a useful rule... (That's what I referred to when I said Perl's module system is more suited to CPAN (now there's a surprise))
Rename? Either cgi -> cgilib or foolib -> foo?
Yes. But I wanted the first proposal to be just about placing stuff, because that airs out more disagreements.
This is one good place for a sub-package. It's a also a good place to rename: the convention for Python module names seems to be all-lowercase; and "Server" is redundant when you're in the net.server package. How about:
net.server.base_http net.server.cgi_http net.server.simple_http net.server.socket
Hmmmmm......+0
Underscores negotiable. They don't seem to be popular in module names, although sometimes they would be real life-savers.
Personally, I prefer underscores to CamelCase.
Or maybe not. I'm just trying to come up with an excuse for moving xml to top-level, which I think is where it belongs. Maybe the excuse should just be, "XML is really important and visible, and anyways Paul Prescod will raise a stink if it isn't put at top-level in Python package-space".
I still think "xml" should be a brother to "html" and "sgml". Current political trans not withstanding.
Not sure what to do about these. Someone referred somewhere to a "web" top-level package, which seems to have disappeared. If it reappars, it would be a good place for the HTML modules (not to mention a big chunk of "net") -- this would mainly be for "important and visible" (ie. PR) reasons, rather than sound technical reasons.
I think the "web" package should be reinstated. But you won't like it: I'd put xml in web.
"mail" should either be top-level or under "net". (Yes, I *know* it's not a wire-level protocol: that's what net.smtplib is for. But last time I checked, email is pretty useless without a network. And vice-versa.)
Ummmm.....I'd disagree, but I lack the strength and the moral conviction. Put it under net and we'll call it a deal <wink>
Or maybe these all belong in a top-level "data" package: I'm starting to warm to that.
Ummmm...I don't like the "data" package personally. It seems to disobey your second guideline.
I agree with Jack: image and sound (audio?) should be top-level. I don't think I like the idea of an intervening "mm" or "multimedia" or "media" or what-have-you package, though.
Definitely multimedia. Okay, I'm bought.
Six crypto-related modules seems like enough to justify a top-level "crypt" package, though.
It seemed obvious to me that "crypt" should be under "math". But maybe that's just the mathematician in me speaking.
I like "python" for this one. (But I'm not sure if tabnanny and rlcompleter belong there.)
I agree, and I'm not sure about rlcompleter, but am sure about tabnanny.
What does ihooks have to do with security?
Well, it was more or less written to support rexec. A weak argument, admittedly
No problem until these last two -- 'commands' is a Unix-specific thing that has very little to do with the filesystem per se
Hmmmmm...it is on the same level with popen. Why not move popen too?
, and 'dl' is (as I understand it) deep ju-ju with sharp edges that should probably be hidden away
Ummmmmm.....not in the "python" package: it doesn't have anything to do with the interpreter.
Should this be "sgi" or "irix"? Ditto for "sun" vs "solaris" if there are a significant number of Sun/Solaris modules. Note that the respective trademark holders might get very antsy about who gets to put names in those namespaces -- that's exactly what happened with Sun, Solaris 8, and Perl. I believe the compromise they arrived at was that the "Solaris::" namespace remains open, but Sun gets the "Sun::" namespace.
Ummmmm.....I don't see how they have any legal standing. I for one refuse to care about what Sun Microsystem thinks about names for Python packages.
There should probably be a win32 package, for core registry access stuff if nothing else.
And for all the other extensions in win32all Yep! (Just goes to show what happens when you decide to package based on a UNIX system)
All of those argue over "irix" and "solaris" instead of "sgi" and "sun".
Fine with me -- just wanted to move them out of my face <wink>
--
Moshe Zadka
On Sun, 26 Mar 2000, Moshe Zadka wrote:
... [ tree ]
This is a great start. I have two comments: 1) keep it *very* shallow. depth just makes it conceptually difficult. 2) you're pushing too hard. modules do not *have* to go into a package. there are some placements that you've made which are very questionable... it appears they are done for movement's sake rather than for being "right" I'm off to sleep, but will look into specific comments tomorrow or so. Cheers, -g -- Greg Stein, http://www.lyra.org/
On Sun, 26 Mar 2000, Greg Stein wrote:
This is a great start. I have two comments:
1) keep it *very* shallow. depth just makes it conceptually difficult.
I tried, and Ping shallowed it even more. BTW: Anyone who cares to comment, please comment on Ping's last suggestion. I pretty much agree with the changes he made.
2) you're pushing too hard. modules do not *have* to go into a package. there are some placements that you've made which are very questionable... it appears they are done for movement's sake rather than for being "right"
Well, I'm certainly sorry I gave that impression -- the reason I wans't
"right" wasn't that, it was more my desire to be "fast" -- I wanted to
have some proposal out the door, since it is harder to argue about
something concrete. The biggest prrof of concept that we all agree is that
no one seriously took objections to anything -- there were just some minor
nits to pick.
--
Moshe Zadka
On Sun, 26 Mar 2000, Moshe Zadka wrote:
On Sun, 26 Mar 2000, Greg Stein wrote: ...
2) you're pushing too hard. modules do not *have* to go into a package. there are some placements that you've made which are very questionable... it appears they are done for movement's sake rather than for being "right"
Well, I'm certainly sorry I gave that impression -- the reason I wans't "right" wasn't that, it was more my desire to be "fast" -- I wanted to have some proposal out the door, since it is harder to argue about something concrete. The biggest prrof of concept that we all agree is that no one seriously took objections to anything -- there were just some minor nits to pick.
Not something to apologize for! :-) Well, the indicator was the line in your original post about "unhandled modules" and the conversation between you and Ping with statements along the lines of "wasn't sure where to put this." I say just leave it then :-) If a module does not make *obvious* sense to be in a package, then it should not be there. For example: locale. That is not about numbers or about text. It has general utility. If there was an i18n package, then it would go there. Otherwise, don't force it somewhere else. Other packages are similar, so don't single out my comment about locale. Cheers, -g -- Greg Stein, http://www.lyra.org/
If a module does not make *obvious* sense to be in a package, then it should not be there. For example: locale. That is not about numbers or about text. It has general utility. If there was an i18n package, then it would go there. Otherwise, don't force it somewhere else. Other packages are similar, so don't single out my comment about locale.
I maintain that a general principle re: what the aim of this reorg is is needed before the partitioning of the space can make sense. What Moshe and Ping have is a good stab at partitioning of a subspace of the total space of Python modules and packages, i.e., the standard library. If we limit the aim of the reorg to cover just that subspace, then that's fine and Ping's proposal seems grossly fine to me. If we want to have a Perl-like packaging, then we _need_ to take into account all known Python modules of general utility, such as the database modules, the various GUI packages, the mx* packages, Aaron's work, PIL, etc., etc. Ignoring those means that the dataset used to decide the partitioning function is highly biased. Given the larger dataset, locale might very well fit in a not-toplevel location. I know that any organizational scheme is going to be optimal at best at its inception, and that as history happens, it will become suboptimal. However, it's important to know what the space being partitioned is supposed to look like. A final comment: there's a history and science to this kind of organization, which is part of library science. I suspect there is quite a bit of knowledge available as to organizing principles to do it right. It would be nice if someone could research it a bit and summarize the basic principles to the rest of us. I agree with Greg that we need high-level input from Guido on this. --david 'academic today' ascher
On Sun, 26 Mar 2000, Greg Stein wrote:
If a module does not make *obvious* sense to be in a package, then it should not be there. For example: locale. That is not about numbers or about text. It has general utility. If there was an i18n package, then it would go there. Otherwise, don't force it somewhere else. Other packages are similar, so don't single out my comment about locale.
I goofed. I apologize. Moshe and Greg are right: locale isn't just about numbers. I just read the comment at the top of locale.py: "Support for number formatting using the current locale settings" and didn't notice the from _locale import * a couple of lines down. "import locale; dir(locale)" didn't work for me because for some reason there's no _locale built-in on my system (Red Hat 6.1, python-1.5.1-10). So i looked for 'def's and they all looked like they had to do with numeric formatting. My mistake. "locale", at least, belongs at the top level. Other candidates for top-level: bisect # algorithm struct # more general than "bin" or "data" colorsys # not really just for image file formats yuvconvert # not really just for image file formats rlcompleter # not really part of the interpreter dl # not really just about files Alternatively, we could have: ui.rlcompleter, unix.dl (It would be nice, by the way, to replace "bisect" with an "algorithm" module containing some nice pedagogical implementations of things like bisect, quicksort, heapsort, Dijkstra's algorithm etc.) The following also could be left at the top-level, since they seem like applications (i.e. they probably won't get imported by code, only interactively). No strong opinion on this. bdb pdb pyclbr tabnanny profile pstats Also... i was avoiding calling the "unix" package "posix" because we already have a "posix" module. But wait... the proposed tree already contains "math" and "time" packages. If there is no conflict (is there a conflict?) then the "unix" package should probably be named "posix". -- ?!ng "In the sciences, we are now uniquely privileged to sit side by side with the giants on whose shoulders we stand." -- Gerald Holton
On Sun, 26 Mar 2000, Ka-Ping Yee wrote:
The following also could be left at the top-level, since they seem like applications (i.e. they probably won't get imported by code, only interactively). No strong opinion on this.
bdb pdb pyclbr tabnanny profile pstats
Let me just state my feelings about the interpreter package: since Python programs are probably the most suited to reasoning about Python programs (among other things, thanks to the strong introspection capabilities of Python), many Python modules were written to supply a convenient interface to that introspection. These modules are *only* needed by programs dealing with Python programs, and hence should live in a well defined part of the namespace. I regret calling it "interpreter" though: "Python" is a better name (something like that java.lang package)
Also... i was avoiding calling the "unix" package "posix" because we already have a "posix" module. But wait... the proposed tree already contains "math" and "time" packages.
Yes. That was a hard decision I made, and I'm sort of waiting for Guido to veto it: it would negate the easy backwards compatible path of providing a toplevel module for each module which is moved somewhere else which does "from import *".
If there is no conflict (is there a conflict?) then the "unix" package should probably be named "posix".
I hardly agree. "dl", for example, is a common function on unices, but it
is not part of the POSIX standard. I think "posix" module should have
POSIX fucntions, and the "unix" package should deal with functinality
available on real-life unices.
standards-are-fun-aren't-they-ly y'rs, Z.
--
Moshe Zadka
Hi! Moshe Zadka wrote:
Yes. That was a hard decision I made, and I'm sort of waiting for Guido to veto it: it would negate the easy backwards compatible path of providing a toplevel module for each module which is moved somewhere else which does "from import *".
If the result of this renaming initiative will be that I can't use import sys, os, time, re, struct, cPickle, parser import Tkinter; Tk=Tkinter; del Tkinter anymore in Python 1.x and instead I have to change this into (for example): form posix import time from text import re from bin import struct from Python import parser from ui import Tkinter; ... ... I would really really *HATE* this change! [side note: The 'from MODULE import ...' form is evil and I have abandoned its use in favor of the 'import MODULE' form in 1987 or so, as our Modula-2 programs got bigger and bigger. With 20+ software developers working on a ~1,000,000 LOC of Modula-2 software system, this decision proofed itself well. The situation with Python is comparable. Avoiding 'from ... import' rewards itself later, when your software has grown bigger and when it comes to maintaince by people not familar with the used modules. ] May be I didn't understand what this new subdivision of the standard library should achieve. The library documentation provides a existing logical subdivision into chapters, which group the library into several kinds of services. IMO this subdivision could be discussed and possibly revised. But at the moment I got the impression, that it was simply ignored. Why? What's so bad with it? Why is a subdivision on the documentation level not sufficient? Why should modules be moved into packages? I don't get it. Regards, Peter -- Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany, Fax:+49 4222950260 office: +49 421 20419-0 (ArtCom GmbH, Grazer Str.8, D-28359 Bremen)
On Mon, 27 Mar 2000, Peter Funk wrote:
If the result of this renaming initiative will be that I can't use import sys, os, time, re, struct, cPickle, parser import Tkinter; Tk=Tkinter; del Tkinter anymore in Python 1.x and instead I have to change this into (for example): form posix import time
from time import time
from text import re from bin import struct from Python import parser from ui import Tkinter; ...
Yes.
I would really really *HATE* this change!
Well, I'm sorry to hear that -- I'm waiting for this change to happen for a long time.
[side note: The 'from MODULE import ...' form is evil and I have abandoned its use in favor of the 'import MODULE' form in 1987 or so, as our Modula-2 programs got bigger and bigger. With 20+ software developers working on a ~1,000,000 LOC of Modula-2 software system, this decision proofed itself well.
Well, yes. Though syntactically equivalent, from package import module Is the recommended way to use packages, unless there is a specific need.
May be I didn't understand what this new subdivision of the standard library should achieve.
Namespace cleanup. Too many toplevel names seem evil to some of us.
Why is a subdivision on the documentation level not sufficient? Why should modules be moved into packages? I don't get it.
To allow a greater number of modules to live without worrying about
namespace collision.
--
Moshe Zadka
Hi, Peter. Your question as to the purpose of module reorganization is well worth asking, and perhaps we should stand back for a while and try to really answer it well first. I think that my answers for your question would be: 1. To alleviate potential namespace collision. 2. To permit talking about packages as a unit. I hereby solicit other reasons from the rest of the group... Reason #1 is not a serious problem yet, but i think i've seen a few cases where it might start to be an issue. Reason #2 has to do with things like assigning people responsibility for taking care of a particular package, or making commitments about which packages will be available with which distributions or platforms. Hence, for example, the idea of the "unix" package. Neither of these reasons necessitate a deep and holy hierarchy, so we certainly want to keep it shallow and simple if we're going to do this at all.
If the result of this renaming initiative will be that I can't use import sys, os, time, re, struct, cPickle, parser import Tkinter; Tk=Tkinter; del Tkinter anymore in Python 1.x and instead I have to change this into (for example): form posix import time from text import re from bin import struct from Python import parser from ui import Tkinter; ...
Won't import sys, os, time.time, text.re, bin.struct, data.pickle, python.parser also work? ...i hope?
The library documentation provides a existing logical subdivision into chapters, which group the library into several kinds of services. IMO this subdivision could be discussed and possibly revised. But at the moment I got the impression, that it was simply ignored. Why? What's so bad with it?
I did look at the documentation for some guidance in arranging the modules, though admittedly it didn't direct me much. -- ?!ng "In the sciences, we are now uniquely privileged to sit side by side with the giants on whose shoulders we stand." -- Gerald Holton
Hi!
import sys, os, time, re, struct, cPickle, parser [...]
Ka-Ping Yee:
Won't
import sys, os, time.time, text.re, bin.struct, data.pickle, python.parser
also work? ...i hope?
That is even worse. So not only the 'import' sections, which I usually keep at the top of my modules, have to be changed: This way for example 're.compile(...' has to be changed into 'text.re.compile(...' all over the place possibly breaking the 'Maximum Line Length' styleguide rule. Regards, Peter
"PF" == Peter Funk
writes:
PF> That is even worse. So not only the 'import' sections, which I PF> usually keep at the top of my modules, have to be changed: This PF> way for example 're.compile(...' has to be changed into PF> 'text.re.compile(...' all over the place possibly breaking the PF> 'Maximum Line Length' styleguide rule. There is nothing wrong with changing only the import statement: from text import re The only problematic use of from ... import ... is from text.re import * which adds an unspecified set of names to the current namespace. Jeremy
On Mon, 27 Mar 2000, Jeremy Hylton wrote:
"PF" == Peter Funk
writes: PF> That is even worse. So not only the 'import' sections, which I PF> usually keep at the top of my modules, have to be changed: This PF> way for example 're.compile(...' has to be changed into PF> 'text.re.compile(...' all over the place possibly breaking the PF> 'Maximum Line Length' styleguide rule.
There is nothing wrong with changing only the import statement: from text import re
The only problematic use of from ... import ... is from text.re import * which adds an unspecified set of names to the current namespace.
Actually, i think there's another important gotcha with from .. import which may be contributing to peter's sense of concern, but which i don't think needs to in this case. I also thought we had discussed providing transparency in general, at least of the 1.x series. ? The other gotcha i mean applies when the thing you're importing is a terminal, ie a non-module. Then, changes to the assignments of the names in the original module aren't reflected in the names you've imported - they're decoupled from the namespace of the original module. When the thing you're importing is, itself, a module, the same kind of thing *can* happen, but you're more generally concerned with tracking revisions to the contents of those modules, which is tracked ok in the thing you "from .. import"ed. I thought the other problem peter was objecting to, having to change the import sections in the first place, was going to be avoided in the 1.x series (if we do this kind of thing) by inherently extending the import path to include all the packages, so people need not change their code? Seems like most of this would be fairly transparent w.r.t. the operation of existing applications. Have i lost track of the discussion? Ken klm@digicool.com
On Mon, 27 Mar 2000, Ken Manheimer wrote:
I also thought we had discussed providing transparency in general, at least of the 1.x series. ?
Yes, but it would be clearly marked as deprecated in 1.7, print out
error messages in 1.8 and won't work at all in 3000. (That's my view on
the point, but I got the feeling this is where the wind is blowing).
So the transperancy mechanism is intended only to be "something backwards
compatible"...it's not supposed to be a reason why things are ugly (I
don't think they are, though).
BTW: the transperancy mechanism I suggested was not pushing things into
the import path, but rather having toplevel modules which "from import *"
from the modules that were moved.
E.g.,
re.py would contain
# Deprecated: don't import re, it won't work in future releases
from text.re import *
--
Moshe Zadka
"KLM" == Ken Manheimer
writes:
The only problematic use of from ... import ... is from text.re import * which adds an unspecified set of names to the current namespace.
KLM> The other gotcha i mean applies when the thing you're importing KLM> is a terminal, ie a non-module. Then, changes to the KLM> assignments of the names in the original module aren't KLM> reflected in the names you've imported - they're decoupled from KLM> the namespace of the original module. This isn't an import issue. Some people simply don't understand that assignment (and import as form of assignment) is name binding. Import binds an imported object to a name in the current namespace. It does not affect bindings in other namespaces, nor should it. KLM> I thought the other problem peter was objecting to, having to KLM> change the import sections in the first place, was going to be KLM> avoided in the 1.x series (if we do this kind of thing) by KLM> inherently extending the import path to include all the KLM> packages, so people need not change their code? Seems like KLM> most of this would be fairly transparent w.r.t. the operation KLM> of existing applications. I'm not sure if there is consensus on backwards compatibility. I'm not in favor of creating a huge sys.path that includes every package's contents. It would be a big performance hit. Jeremy
On Tue, 28 Mar 2000, Jeremy Hylton wrote:
"KLM" == Ken Manheimer
writes: The only problematic use of from ... import ... is from text.re import * which adds an unspecified set of names to the current namespace.
KLM> The other gotcha i mean applies when the thing you're importing KLM> is a terminal, ie a non-module. Then, changes to the KLM> assignments of the names in the original module aren't KLM> reflected in the names you've imported - they're decoupled from KLM> the namespace of the original module.
This isn't an import issue. Some people simply don't understand that assignment (and import as form of assignment) is name binding. Import binds an imported object to a name in the current namespace. It does not affect bindings in other namespaces, nor should it.
I know that - i was addressing the asserted evilness of from ... import ... and how it applied - and didn't - w.r.t. packages.
KLM> I thought the other problem peter was objecting to, having to KLM> change the import sections in the first place, was going to be KLM> avoided in the 1.x series (if we do this kind of thing) by KLM> inherently extending the import path to include all the KLM> packages, so people need not change their code? Seems like KLM> most of this would be fairly transparent w.r.t. the operation KLM> of existing applications.
I'm not sure if there is consensus on backwards compatibility. I'm not in favor of creating a huge sys.path that includes every package's contents. It would be a big performance hit.
Yes, someone reminded me that the other (better, i think) option is stub modules in the current places that do the "from ... import *" for the right values of "...". py3k finishes the migration by eliminating the stubs. Ken klm@digicool.com
Peter Funk said:
The library documentation provides a existing logical subdivision into chapters, which group the library into several kinds of services. IMO this subdivision could be discussed and possibly revised. But at the moment I got the impression, that it was simply ignored. Why? What's so bad with it?
Ka-Ping Yee writes:
I did look at the documentation for some guidance in arranging the modules, though admittedly it didn't direct me much.
The library reference is pretty well disorganized at this point. I want to improve that for the 1.6 docs. I received a suggestion a few months back, but haven't had a chance to dig into it, or even respond to the email. ;( -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> Corporation for National Research Initiatives
Peter Funk said:
The library documentation provides a existing logical subdivision into chapters, which group the library into several kinds of services. IMO this subdivision could be discussed and possibly revised. But at the moment I got the impression, that it was simply ignored. Why? What's so bad with it?
Ka-Ping Yee writes:
I did look at the documentation for some guidance in arranging the modules, though admittedly it didn't direct me much.
Fred L. Drake, Jr. writes:
The library reference is pretty well disorganized at this point. I want to improve that for the 1.6 docs.
Let me just mention where my inspirations came from: shame of shames, it
came from Perl. It's hard to use Perl's organization as is, because it
doesn't (view itself) as a general purpose langauge: so things like CGI.pm
are toplevel, and regex's are part of the syntax. However, there are a lot
of good hints there.
--
Moshe Zadka
Peter> The library documentation provides a existing logical subdivision Peter> into chapters, which group the library into several kinds of Peter> services. Perhaps it makes sense to revise the library reference manual's documentation to reflect the proposed package hierarchy once it becomes concrete. -- Skip Montanaro | http://www.mojam.com/ skip@mojam.com | http://www.musi-cal.com/
Skip Montanaro writes:
Perhaps it makes sense to revise the library reference manual's documentation to reflect the proposed package hierarchy once it becomes concrete.
I'd go for this. ;) -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> Corporation for National Research Initiatives
Peter Funk wrote:
Why should modules be moved into packages? I don't get it.
fwiw, neither do I... I'm not so sure that Python really needs a simple reorganization of the existing set of standard library modules. just moving the modules around won't solve the real problems with the 1.5.2 std library...
IMO this subdivision could be discussed and possibly revised.
here's one proposal: http://www.pythonware.com/people/fredrik/librarybook-contents.htm </F>
Hi!
Peter Funk wrote:
Why should modules be moved into packages? I don't get it.
Fredrik Lundh:
fwiw, neither do I...
Pheeewww... And I thought I'am the only one! ;-)
I'm not so sure that Python really needs a simple reorganization of the existing set of standard library modules. just moving the modules around won't solve the real problems with the 1.5.2 std library...
Right. I propose to leave the namespace flat. I like to argue with Brad J. Cox ---the author of the book "Object Oriented Programming - An Evolutionary Approach" Addison Wesley, 1987--- who proposes the idea of what he calls a "Software-IC": He looks closely to design process of electronic engineers which ussually deal with large data books with prefabricated components. There are often hundreds of them in such a databook and most of them have terse and not very mnemonic names. But the engineers using them all day *know* after a short while that a 7400 chip is a TTL-chip containing 4 NAND gates. Nearly the same holds true for software engineers using Software-IC like 're' or 'struct' as their daily building blocks. A software engineer who is already familar with his/her building blocks has absolutely no advantage from a deeply nested namespace. Now for something completely different: Fredrik Lundh about the library documentation:
here's one proposal: http://www.pythonware.com/people/fredrik/librarybook-contents.htm
Whether 'md5', 'getpass' and 'traceback' fit into a category 'Commonly Used Modules' is ....ummmm.... at least a bit questionable. But we should really focus the discussion on the structure of the documentation. Since many standard library modules belong into several logical catagories at once, a true tree structured organization is simply not sufficient to describe everything. So it is important to set up pointers between related functionality. For example 'string.replace' is somewhat related to 're.sub' or 'getpass' is related to 'crypt', however 'crypt' is related to 'md5' and so on. Regards, Peter -- Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany, Fax:+49 4222950260 office: +49 421 20419-0 (ArtCom GmbH, Grazer Str.8, D-28359 Bremen)
Peter Funk quoted:
Fredrik Lundh:
I'm not so sure that Python really needs a simple reorganization of the existing set of standard library modules. just moving the modules around won't solve the real problems with the 1.5.2 std library... Right. I propose to leave the namespace flat.
I third that comment. Arguments against reorganizing for 1.6: 1) I doubt that we have time to do a good job of it for 1.6. (1.7, maybe.) 2) Right now there's no way for third-party extensions to add themselves to a package in the standard library. Once Python finds foo/__init__.py, it won't look for site-packages/foo/__init__.py, so if you grab, say, "crypto" as a package name in the standard library, it's forever lost to third-party extensions. 3) Rearranging the modules is a good chance to break backward compatibility in other ways. If you want to rewrite, say, httplib in a non-compatible way to support HTTP/1.1, then the move from httplib.py to net.http.py is a great chance to do that, and leave httplib.py as-is for old programs. If you just copy httplib.py, rewriting net.http.py is now harder, since you have to either maintain compatibility or break things *again* in the next version of Python. 4) We wanted to get 1.6 out fairly quickly, and therefore limited the number of features that would get in. (Vide the "Python 1.6 timing" thread last ... November, was it?) Packagizing is feature creep that'll slow things down Maybe we should start a separate list to discuss a package hierarchy for 1.7. But for 1.6, forget it. -- A.M. Kuchling http://starship.python.net/crew/amk/ Posting "Please send e-mail, since I don't read this group": Poster is rendered illiterate by a simple trepanation. -- Kibo, in the Happynet Manifesto
Maybe we should start a separate list to discuss a package hierarchy for 1.7. But for 1.6, forget it.
Yes! Please! --Guido van Rossum (home page: http://www.python.org/~guido/)
On Tue, 28 Mar 2000, Andrew M. Kuchling wrote:
Peter Funk quoted:
Fredrik Lundh:
I'm not so sure that Python really needs a simple reorganization of the existing set of standard library modules. just moving the modules around won't solve the real problems with the 1.5.2 std library... Right. I propose to leave the namespace flat.
I third that comment. Arguments against reorganizing for 1.6:
Let me just note that my original great renaming proposal was titled "1.7". I'm certain I don't want it to affect the 1.6 release -- my god, it's almost alpha time and we don't even know how to reorganize. Strictly 1.7.
4) We wanted to get 1.6 out fairly quickly, and therefore limited the number of features that would get in. (Vide the "Python 1.6 timing" thread last ... November, was it?) Packagizing is feature creep that'll slow things down
Oh yes. I'm waiting for that 1.6....I wouldn't want to stall it for the
world.
But this is a good chance as any to discuss reasons, before strategies.
Here's why I believe we should re-organize Python modules:
-- modules fall quite naturally into subpackages. Reducing the number
of toplevel modules will lessen the clutter
-- it would be easier to synchronize documentation and code (think
"automatically generated documentation")
-- it would enable us to move toward a CPAN-like module repository,
together with the dist-sig efforts.
--
Moshe Zadka
Andrew M. Kuchling wrote: [snip]
2) Right now there's no way for third-party extensions to add themselves to a package in the standard library. Once Python finds foo/__init__.py, it won't look for site-packages/foo/__init__.py, so if you grab, say, "crypto" as a package name in the standard library, it's forever lost to third-party extensions.
That way lies madness. While I'm happy to carp at Java for requiring "com", "net" or whatever as a top level name, their intent is correct: the names grabbed by the Python standard packages belong to no one but the Python standard packages. If you *don't* do that, upgrades are an absolute nightmare. Marc-Andre grabbed "mx". If (as I rather suspect <wink>) he wants to remake the entire standard lib in his image, he's welcome to - *under* mx. What would happen if he (and everyone else) installed themselves *into* my core packages, then I decided I didn't want his stuff? More than likely I'd have to scrub the damn installation and start all over again. - Gordon
On Tue, 28 Mar 2000, Gordon McMillan wrote:
What would happen if he (and everyone else) installed themselves *into* my core packages, then I decided I didn't want his stuff? More than likely I'd have to scrub the damn installation and start all over again.
I think Greg Stein answered that objection, by reminding us that the
filesystem isn't the only way to set up a package hierarchy. In
particular, even with Python's current module system, there is no need to
scrub installations: Python core modules go (under UNIX) in
/usr/local/lib/python1.5, and 3rd party modules go in
/usr/local/lib/python1.5/site-packages. Need to remove stuff? Remove
whatever is in /usr/local/lib/python1.5/site-packages. Need to upgrade?
Just backup /usr/local/lib/python1.5/site-packages, remove
/usr/local/lib/python1.5/, install, and move 3rd party modules back from
backup. This becomes even easier if the standard installation is in a
JAR-like file, and 3rd party modules are also in a JAR-like file, but
specified to be in their natural place.
Wow! That was a long rant!
Anyway, I already expressed my preference of the Perl way, over the Java
way. For one thing, I don't want to have to register a domain just so I
could distribute Python code <wink>
--
Moshe Zadka
Moshe Zadka wrote:
On Tue, 28 Mar 2000, Gordon McMillan wrote:
What would happen if he (and everyone else) installed themselves *into* my core packages, then I decided I didn't want his stuff? More than likely I'd have to scrub the damn installation and start all over again.
I think Greg Stein answered that objection, by reminding us that the filesystem isn't the only way to set up a package hierarchy.
You mean when Greg said:
Assuming that you use an archive like those found in my "small" distro or Gordon's distro, then this is no problem. The archive simply recognizes and maps "text.encoding.macbinary" to its own module.
I don't know what this has to do with it. When we get around to the 'macbinary' part, we have already established that 'text.encoding' is the parent which should supply 'macbinary'.
In particular, even with Python's current module system, there is no need to scrub installations: Python core modules go (under UNIX) in /usr/local/lib/python1.5, and 3rd party modules go in /usr/local/lib/python1.5/site-packages.
And if there's a /usr/local/lib/python1.5/text/encoding, there's no way that /usr/local/lib/python1.5/site- packages/text/encoding will get searched. I believe you could hack up an importer that did allow this, and I think you'd be 100% certifiable if you did. Just look at the surprise factor. Hacking stuff into another package is just as evil as math.pi = 42.
Anyway, I already expressed my preference of the Perl way, over the Java way. For one thing, I don't want to have to register a domain just so I could distribute Python code <wink>
I haven't the foggiest what the "Perl way" is; I wouldn't be surprised if it relied on un-Pythonic sociological factors. I already said the Java mechanics are silly; uniqueness is what matters. When Python packages start selling in the four and five figure range <snort>, then a registry mechanism will likely be necessary. - Gordon
On Wed, 29 Mar 2000, Gordon McMillan wrote:
And if there's a /usr/local/lib/python1.5/text/encoding, there's no way that /usr/local/lib/python1.5/site- packages/text/encoding will get searched.
Oh my god! I just realized you're right. Well, back to the drawing board.
I haven't the foggiest what the "Perl way" is; I wouldn't be surprised if it relied on un-Pythonic sociological factors.
No, it relies on non-Pythonic (but not unpythonic -- simply different) technical choices.
I already said the Java mechanics are silly; uniqueness is what matters.
As in all things namespacish ;-)
Though I suspect a registry will be needed much sooner.
--
Moshe Zadka
On Wed, 29 Mar 2000, Gordon McMillan wrote:
Moshe Zadka wrote:
On Tue, 28 Mar 2000, Gordon McMillan wrote:
What would happen if he (and everyone else) installed themselves *into* my core packages, then I decided I didn't want his stuff? More than likely I'd have to scrub the damn installation and start all over again.
I think Greg Stein answered that objection, by reminding us that the filesystem isn't the only way to set up a package hierarchy.
You mean when Greg said:
Assuming that you use an archive like those found in my "small" distro or Gordon's distro, then this is no problem. The archive simply recognizes and maps "text.encoding.macbinary" to its own module.
I don't know what this has to do with it. When we get around to the 'macbinary' part, we have already established that 'text.encoding' is the parent which should supply 'macbinary'.
good point...
In particular, even with Python's current module system, there is no need to scrub installations: Python core modules go (under UNIX) in /usr/local/lib/python1.5, and 3rd party modules go in /usr/local/lib/python1.5/site-packages.
And if there's a /usr/local/lib/python1.5/text/encoding, there's no way that /usr/local/lib/python1.5/site- packages/text/encoding will get searched.
I believe you could hack up an importer that did allow this, and I think you'd be 100% certifiable if you did. Just look at the surprise factor.
Hacking stuff into another package is just as evil as math.pi = 42.
Not if the package was designed for it. For a "package" like "net", it would be perfectly acceptable to allow third-parties to define that as their installation point. And yes, assume there is an importer that looks into the installed archives for modules. In the example, the harder part is determining where the "text.encoding" package is loaded from. And yah: it may be difficult to arrange the the text.encoding's importer to allow for archive searching. Cheers, -g -- Greg Stein, http://www.lyra.org/
Gordon McMillan wrote:
Andrew M. Kuchling wrote: [snip]
2) Right now there's no way for third-party extensions to add themselves to a package in the standard library. Once Python finds foo/__init__.py, it won't look for site-packages/foo/__init__.py, so if you grab, say, "crypto" as a package name in the standard library, it's forever lost to third-party extensions.
That way lies madness. While I'm happy to carp at Java for requiring "com", "net" or whatever as a top level name, their intent is correct: the names grabbed by the Python standard packages belong to no one but the Python standard packages. If you *don't* do that, upgrades are an absolute nightmare.
Marc-Andre grabbed "mx". If (as I rather suspect <wink>) he wants to remake the entire standard lib in his image, he's welcome to - *under* mx.
Right, that's the way I see it too. BTW, where can I register the "mx" top-level package name ? Should these be registered in the NIST registry ? Will the names registered there be honored ?
What would happen if he (and everyone else) installed themselves *into* my core packages, then I decided I didn't want his stuff? More than likely I'd have to scrub the damn installation and start all over again.
That's a no-no, IMHO. Unless explicitly allowed, packages should *not* install themselves as subpackages to other existing top-level packages. If they do, its their problem if the hierarchy changes... -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/
Marc-Andre grabbed "mx". If (as I rather suspect <wink>) he wants to remake the entire standard lib in his image, he's welcome to - *under* mx.
Right, that's the way I see it too. BTW, where can I register the "mx" top-level package name ? Should these be registered in the NIST registry ? Will the names registered there be honored ?
I think the NIST registry is a failed experiment -- too cumbersome to maintain or consult. We can do this the same way as common law handles trade marks: if you have used it as your brand name long enough, even if you didn't register, someone else cannot grab it away from you.
What would happen if he (and everyone else) installed themselves *into* my core packages, then I decided I didn't want his stuff? More than likely I'd have to scrub the damn installation and start all over again.
That's a no-no, IMHO. Unless explicitly allowed, packages should *not* install themselves as subpackages to other existing top-level packages. If they do, its their problem if the hierarchy changes...
Agreed. Although some people seem to *want* this. Probably because it's okay to do that in Java and (apparently?) in Perl. And C++, probably. It all probably stems back to Lisp. I admit that I didn't see this subtlety when I designed Python's package architecture. It's too late to change (e.g. because of __init__.py). Is it a problem though? Let's be open-minded about this and think about whether we want to allow this or not, and why... --Guido van Rossum (home page: http://www.python.org/~guido/)
Hi! Guido van Rossum:
I think the NIST registry is a failed experiment -- too cumbersome to maintain or consult.
The WEB frontend of the NIST registry is not that bad --- if you are even aware of the fact, that such a beast exists! I use Python since 1994 and discovered the NIST registry incidental a few weeks ago, when I was really looking for something about the Win32 registry and used the search engine on www.python.org. My first thought was: What a neat clever idea! I think this is an example how the Python community suffers from poor advertising of good ideas.
We can do this the same way as common law handles trade marks: if you have used it as your brand name long enough, even if you didn't register, someone else cannot grab it away from you.
Okay. But a more formal registry wouldn't hurt. Something like the global module index from the current docs supplemented with all contribution modules which can be currently found a www.vex.net would be a useful resource. Regards, Peter
On Tue, 28 Mar 2000, Fredrik Lundh wrote:
IMO this subdivision could be discussed and possibly revised.
here's one proposal: http://www.pythonware.com/people/fredrik/librarybook-contents.htm
Wow. I don't think i hardly ever use any of the modules in your "Commonly Used Modules" category. Except traceback, from time to time, but that's really the only one! Hmm. I'd arrange things a little differently, though i do like the category for Data Representation (it should probably go next to Data Storage though). I would prefer a separate group for interpreter-and-development-related things. The "File Formats" group seems weak... to me, its contents would better belong in a "parsing" or "text processing" classification. urlparse definitely goes with urllib. These comments are kind of random, i know... maybe i'll try putting together another grouping if i have any time. -- ?!ng
Moshe Zadka writes:
Well, I'm certainly sorry I gave that impression -- the reason I wans't "right" wasn't that, it was more my desire to be "fast" -- I wanted to have some proposal out the door, since it is harder to argue about something concrete. The biggest prrof of concept that we all agree is that no one seriously took objections to anything -- there were just some minor nits to pick.
It's *really easy* to argue about something concrete. ;) It's just harder to misunderstand the specifics of the proposal. It's too early to say what people think; not enough people have had time to look at the proposals yet. On the other hand, I think its great -- that we have a proposal to discuss. I'll make my comments after I've read through the last version posted when I have time to read these. -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> Corporation for National Research Initiatives
participants (16)
-
Andrew M. Kuchling
-
Daniel Berlin
-
David Ascher
-
Fred L. Drake, Jr.
-
Fredrik Lundh
-
Gordon McMillan
-
Greg Stein
-
Greg Ward
-
Guido van Rossum
-
Jeremy Hylton
-
Ka-Ping Yee
-
Ken Manheimer
-
M.-A. Lemburg
-
Moshe Zadka
-
pf@artcom-gmbh.de
-
Skip Montanaro