On 04/24/12 18:18, Rotwang wrote:
Sorry if this is a stupid question, but what is up with this:
>>> from calendar import*
>>> Calendar
Traceback (most recent call last):
File "<pyshell#9>", line 1, in<module>
Calendar
NameError: name 'Calendar' is not defined
>>> from calendar import Calendar
>>> Calendar
<class 'calendar.Calendar'>
If you view the source, you can see that __all__ is declared
without containing "Calendar" in it. So when you do "from
calendar import *", only the things that are in __all__ are exported.
Now the REASON why "Calendar" is absent from __all__ is a
question for the developers of the module. But at least that's
why Python is masking it from you.
-tkc
--
http://mail.python.org/mailman/listinfo/python-list