apply
apply(function, args[, keywords])
Calls a function with positional arguments taken from a sequence, and keyword arguments taken from a dictionary.
The function argument must be a callable object (a user-defined or built-in function or method, or a class object) and the args argument must be a sequence. The function is called with args as the argument list; the number of arguments is the length of the tuple. If the optional keywords argument is present, it must be a dictionary whose keys are strings. It specifies keyword arguments to be added to the end of the argument list.
Calling apply is different from just
calling function(args), since in that case there is always exactly
one argument. The use of apply is equivalent to
function(*args, **keywords). Use of apply is not necessary
since the extended call syntax,
as used in the last example,
is completely equivalent.
Deprecated since release 2.3. New code should use the extended call syntax instead, as described above.