import x as y
Moshe Zadka
moshez at math.huji.ac.il
Mon Oct 30 01:16:51 EST 2000
On Sun, 29 Oct 2000, Tyler Eaves wrote:
> Just wondering, as a python 'advanced' novice, is there any advantage
> of:
>
> import x as y
>
> ratheer than
>
> import x
> y=x
> ?
>
> Or is it just the elimination of the extra line?
And the namespace polution: the "as" version doesn't create a variable
named x.
The "as" version is equivalent to
import x;y=x;del x
It happened so much, it has been decided to make it a one-liner.
--
Moshe Zadka <moshez at math.huji.ac.il> -- 95855124
http://advogato.org/person/moshez
More information about the Python-list
mailing list