CONSTRUCT - Module Attributes and Execution Environment
lazaridis_com
ilias at lazaridis.com
Tue Aug 22 09:27:07 EDT 2006
I would like to change the construct:
if __name__ == '__main__':
to something like:
if exec.isMain():
My (OO thought) is to place a class in an separate code module and to
instantiate an singleton instance which would keep th something like
this:
class ExecutionEnv:
def isMain(self)
if CALLING_MODULE.__name__ == '__main__':
return true
else
return false
exec = ExecutionEnv()
How to I get access to the CALLING_MODULE ?
-
Are ther alternative constructs/mechanism available, which could be
used to add this functionality possiby directly to a code-module?
More information about the Python-list
mailing list