June 2002
Beginner to intermediate
640 pages
14h 24m
English
You don't need to know functional programming to develop Python code, but learning it can reduce the amount of code you write.
The apply(function, args, [keywords]) function needs a callable object as the function argument, which it calls with args as the argument list (and keywords as the named argument list). args is a sequence, keywords a dictionary.
The function
>>> def hello(str): ... print "hello " + str ...
can be called with apply() like this:
>>> apply(hello,("Bobby",))
hello Bobby
Without apply() it's called like this.
>>> hello("Bobby")
hello Bobby
You can use apply()to call several functions. Or you can have several functions operating on the same data. ...
Read now
Unlock full access