On Tue, 8 May 2007 09:38:48 +0200, Cesar Härdfeldt wrote
> [...]
> I now have 'module' and 'function' as strings and 'parms' normally as a list
> of strings. I can import the module by __import__(module) but is there
> another way to call:
> module.function(parms) than using eval()?
function_t
[EMAIL PROTECTED] (Bengt Richter) writes:
>>For a lot of uses, it'd be better to build the dictionary by hand
>>rather than relying on one of the tools that turns a namespace into a
>>dictionary.
> IMO it would be nice if name lookup were as cleanly
> controllable and defined as attribute/method lo
On Wed, 02 Nov 2005 19:01:46 -0500, Mike Meyer <[EMAIL PROTECTED]> wrote:
>"Paul McGuire" <[EMAIL PROTECTED]> writes:
>> "David Rasmussen" <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED]
>>> If I have a string that contains the name of a function, can I call it?
>>> As in:
>>>
>>> d
David Rasmussen wrote:
> If I have a string that contains the name of a function, can I call it?
> As in:
>
> def someFunction():
> print "Hello"
>
> s = "someFunction"
> s() # I know this is wrong, but you get the idea...
py> eval("someFunction()")
'Hello'
py> eval(s)() # note the second
"Paul McGuire" <[EMAIL PROTECTED]> writes:
> "David Rasmussen" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> If I have a string that contains the name of a function, can I call it?
>> As in:
>>
>> def someFunction():
>> print "Hello"
>>
>> s = "someFunction"
>> s() # I know this
"David Rasmussen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> If I have a string that contains the name of a function, can I call it?
> As in:
>
> def someFunction():
> print "Hello"
>
> s = "someFunction"
> s() # I know this is wrong, but you get the idea...
>
> /David
Lookup th