[Python-Dev] Add __exports__ to modules

Ka-Ping Yee ping@lfw.org
2001年1月11日 07:14:17 -0800 (PST)


On 2001年1月10日, 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.

Please don't use __all__. At the moment, __all__ is the only way
to easily tell whether a particular module object really represents
a package, and the only way to get the list of submodule names.
If __all__ is overloaded to also represent exportable symbols in
modules, these two pieces of information will be impossible (or
require much ugly hackery) to obtain.
-- ?!ng

AltStyle によって変換されたページ (->オリジナル) /