Le 12/11/2011 13:29, Arnaud Delobelle a écrit :

-- The second case seems to be rather widespread and causes math attribute
to be private but I don't figure out why this matters.

This way math doesn't get bound in the global namespace when doing
"from module import *"



To contextualize more, I guess you are referring to the following situation :



# 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 ?
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to