candide wrote:
> First, could you confirm the following syntax
>
> import foo as f
>
> equivalent to
>
> import foo
> f = foo
>
>
>
> Now, I was wondering about the usefulness in everyday programming of
the
> as syntax within an import statement. [ ... ]
It gives you an out in a case like
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> os = 5 # number of 'o's
>>> import os as opsys
>>> os
5
>>> opsys
<module 'os' from '/usr/lib/python2.6/os.pyc'>
(This is an instance of what arnaud mentioned.)
Mel.
--
http://mail.python.org/mailman/listinfo/python-list