[Python-Dev] Add __exports__ to modules
Michael Hudson
mwh21@cam.ac.uk
Wed, 10 Jan 2001 22:02:49 +0000 (GMT)
On Wed, 10 Jan 2001, Paul Prescod wrote:
> Guido van Rossum wrote:
> >
> > ...
> >
> > Yes -- I came up with the same thought.
> >
> > So here's a plan: somebody please submit a patch that does only one
> > thing: from...import * looks for __all__ and if it exists, imports
> > exactly those names. No changes to dir(), or anything.
>
> Why? From my point of view, the changes to dir() are much more
> important. I seldom tell newbies about import * but I always tell them
> how they can browse objects (especially modules) with dir. If dir() is
> changed then IDEs and so forth would use that and inherit the right
> behavior. If the module exporting behavior gets more sophisticated in a
> future version of Python they will continue to inherit the behavior.
Changing dir would also make rlcompleter nicer - it's something of a pain
to use with a module that has, eg, "from TERMIOS import *"-ed. This might
also make "from ... import *" less of a pariah...
Sounds good to me, IOW.
Cheers,
M.