CONSTRUCT - Module Attributes and Execution Environment

lazaridis_com ilias at lazaridis.com
Sun Aug 27 07:31:00 EDT 2006


lazaridis_com wrote:
> I would like to change the construct:
>
> if __name__ == '__main__':
...

Is there a standard way / naming to wrap "__name__" and other similar
attributes to an encapsulating class?

Something like e.g.:

if mod.name ...

or

if gbl.name ...

-

"gbl.newAttribute = value" would create __newAttribute__

This should become available whereever such __<attributes>__ occour.

(I assume this should be implementable with e.g. metaclasses)




More information about the Python-list mailing list