[Python-Dev] The more I think about __all__ ...

Jeremy Hylton jeremy@alum.mit.edu
Tue, 27 Feb 2001 12:26:34 -0500 (EST)


It seems to be to be a compatibility issue.  If a module has an
__all__, then from module import * may behave differently in Python
2.1 than it did in Python 2.0.  The only problem of this sort I have
encountered is with pickle, but I seldom use import *.  

The problem ends up being obscure to debug because you get a
NameError.  Then you hunt around in the middle and see that the name
is never bound.  Then you see that there is an import * -- and
hopefully only one!  Then you think, "Didn't Python grow __all__
enforcement in 2.1?"  And you start hunting around for that name in
the import module and check to see if it's in __all__.

Jeremy