[Tutor] getattr()
Kent Johnson
kent37 at tds.net
Wed Jul 26 19:52:24 CEST 2006
Tony Cappellini wrote:
> From: Kent Johnson <kent37 at tds.net>
>
>
>>> or you can import __main__, which is the top-level module
> Do you mean __main__ is the top level module for every python
> program/script?
>
Yes, at least in the standard Python runtime, I'm not sure what happens
when running in IDLE, for example.
> Where did you read about this?
Not sure, but this is what makes the test for __name__ == '__main__'
work, and importing __main__ comes up occasionally on comp.lang.python.
Also see
http://docs.python.org/ref/naming.html#l2h-320
Kent
PS Please reply on list.
More information about the Tutor
mailing list