[Python-ideas] Allow 'import star' with namespaces
Ethan Furman
ethan at stoneleaf.us
Fri May 6 22:12:00 CEST 2011
Brendan Moloney wrote:
> dag.odenhall at gmail.com wrote:
>> I like this idea, except it's inconsistent with from-import-star, the
>> latter which does *not* get you sub-packages or modules.
>
> Georg Brandl [g.brandl at gmx.net] wrote:
>> And that's for a reason: it's not easy (I think it's even impossible, because
>> for example individual submodules can change __path__) to determine all
>> importable submodules of a package.
>
>> So ``import pkg.*`` would not have any behavior other than ``import pkg``.
>
> When I said all _public_ sub-packages and modules I was referring to those
> listed in the __all__ attribute of 'pkg'. Thus it would behave in
the exact
> same way as from-import-star except you don't pollute the current
namespace.
I'm not catching the vision -- could you put together a short example
that would illustrate?
~Ethan~
More information about the Python-ideas
mailing list