lazaridis_com wrote:
> 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?
...
see follow-up thread:
http://groups.google.com/group
Larry Bates wrote:
> 1) Don't call a class instance exec, it will mask the built-in
> exec statement.
"exec" is a reserved word, and cannot be masked:
>>> exec = 10
File "", line 1
exec = 10
^
SyntaxError: invalid syntax
--
http://mail.python.org/mailman/listinfo/python-li
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" wo
Larry Bates wrote:
> lazaridis_com wrote:
> > 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
Duncan Booth wrote:
> lazaridis_com wrote:
>
> > Are ther alternative constructs/mechanism available, which could be
> > used to add this functionality possiby directly to a code-module?
>
> How about something along these lines:
>
> -- auto.py -
> import sys, atexit
>
> de
Fuzzyman wrote:
> lazaridis_com wrote:
> > 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 ke
Georg Brandl wrote:
> Larry Bates wrote:
>> lazaridis_com wrote:
>>> 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 singlet
Larry Bates wrote:
> lazaridis_com wrote:
>> 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
lazaridis_com wrote:
> 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:
>
>
lazaridis_com wrote:
> Are ther alternative constructs/mechanism available, which could be
> used to add this functionality possiby directly to a code-module?
How about something along these lines:
-- auto.py -
import sys, atexit
def main_body(f):
if f.func_globals['
lazaridis_com wrote:
> 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:
>
> clas
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)
12 matches
Mail list logo