In article , WH wrote:
>
>'x' in getattr() should be a reference to the "__main__" module, right?
>How to get it?
Just for the record, the best way to get a reference to __main__ is to
import it:
import __main__
--
Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/
On Tue, 08 Jun 2010 22:29:04 -0700, WH wrote:
> Hi,
>
> I want to use one of two functions in a script:
>
> def func_one(): pass
> def func_two(): pass
>
> func = getattr(x, 'func_'+number)
> func()
>
> 'x' in getattr() should be a reference to the "__main__" module, right?
> How to get it?
On Tue, Jun 8, 2010 at 10:29 PM, WH wrote:
> Hi,
>
> I want to use one of two functions in a script:
>
> def func_one(): pass
> def func_two(): pass
>
> func = getattr(x, 'func_'+number)
> func()
>
> 'x' in getattr() should be a reference to the "__main__" module, right?
> How to get it?
from sy
Hi,
I want to use one of two functions in a script:
def func_one(): pass
def func_two(): pass
func = getattr(x, 'func_'+number)
func()
'x' in getattr() should be a reference to the "__main__" module, right?
How to get it? The 'if' clause should work here. I am just curious if
we can use the