2.1 strangness

Skip Montanaro skip at pobox.com
Thu May 31 21:27:12 CEST 2001

    Robin> thanks; I'm still a bit puzzled as to the exact semantics. It
    Robin> just looks wrong. Is __all__ the only way to get things into the
    Robin> * version of import?

Essentially, yes.  If you want to just dispense with it __all__together
(=:-o), you can textually replace __all__ with ___all__ in each of the
standard library modules:

    cd /usr/local/lib/python2.1
    for f in *.py ; do
	sed -e 's/___*all__/___all__/g' < $f > $f.tmp
	mv $f.tmp $f

Note that I didn't touch any files in directories under the basic Lib

    Robin> Presumably HTTPConnection is being marked as a potential global
    Robin> in the compile phase.

It has nothing to do with module compilation.  The contents of __all__ are a
static thing in the text of the .py file, and thusfar almost entirely due to
me studying the inputs at hand and making a decision about what belonged and
what didn't.  Some python-dev people caught ommissions and added them before
the 2.1 release.  Other than that, the mistakes are all mine.

I had some misgivings about the whole thing during the midst of the task and
still do, but grumbled once and completed it.


More information about the Python-list mailing list