On Nov 18, 1:48 am, candide <cand...@free.invalid> wrote: > # a.py > import math as _math > > # b.py > from a import * > > print _math.sin(0) # raise a NameError > print math.sin(0) # raise a NameError > > so the as syntax is also seful for hiding name, isn'it ?
Not exactly. It's the * import mechanism here that's ignoring any bindings that begin with an underscore. If you had: _dummy = 1 ...inside of a.py, it wouldn't be pulled in either. As you state later, 'as' is purely a binding convenience. Incidentally, you can still allow * import to bring in underscore- prefixed bindings by adding them to an __all__: __all__ = ['_dummy'] -- http://mail.python.org/mailman/listinfo/python-list