func(*params)

Nick Smallbone nick.smallbone at gmail.com
Fri Nov 18 22:49:39 CET 2005


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