the demise of 'from foo import * and its implications?

Steve Holden sholden at holdenweb.com
Mon Mar 5 21:19:09 EST 2001


[me]
...as a reference to the module's "i", but I'm not sure that the gain is
worth
the pain. Even if such a proposal were to be PEP-ified and accepted it could
not be mandated because that would break humongous amounts of existing code.

[the martellibot]
But why not just
    import modulewithaverylongname as sh
and then use
      sh.i
...?

You can do that today, and the detailed semantics seem
likelier to be what is desired (e.g., should attribute
i of the module ever be re-bound, it's probably better
to automatically pick up the new reference, as happens
by using sh.i, than keep using the old one, as any
'from/import' approach would do -- marginal stuff, sure).

["Qrczak"]
>
> I don't see why do to this, and it's certainly not a feature to go
> into the standard language.
>
> An opposite trick can be used if a module is designed to be
> star-imported and uses name prefixes, but we dislike star-import.
> We can remove prefixes while moving objects to a separate namespace.
>
Erm, OK. So we all agree, then. What I said was not a very good idea really
*was not* a very good idea.

but-i-thought-i'd-said-that-already-ly y'rs  - steve






More information about the Python-list mailing list