func(*params)

David Duerrenmatt dduerrenmatt at swissonline.ch
Fri Nov 18 16:52:58 EST 2005


Great, this is exactly what I was looking for.

Thanks all of you for your immediate answer!




Nick Smallbone schrieb:
> David Duerrenmatt wrote:
> 
>>Hi there
>>
>>For some reasons, I've to use Python 1.5.2 and am looking for a workaround:
>>
>>In newer Python versions, I can call a function this way:
>>
>>func = some_function
>>func(*params)
>>
> 
> 
> I think the "apply" function is what you want:
> 
> apply(object[, args[, kwargs]]) -> value
> 
> Call a callable object with positional arguments taken from the tuple
> args, and keyword arguments taken from the optional dictionary kwargs.
> Note that classes are callable, as are instances with a __call__()
> method.
> 
> Deprecated since release 2.3. Instead, use the extended call syntax:
>     function(*args, **keywords).
> 



More information about the Python-list mailing list