-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Functional Python Programming

Python offers us many ways to create higher-order functions. In Chapter 5, Higher-Order Functions, we looked at two techniques: defining a function that accepts a function as an argument, and defining a subclass of Callable
, which is either initialized with a function or called with a function as an argument.
One of the benefits of decorated functions is that we can create composite functions. These are single functions that embody functionality from several sources. A composite function,
, can be somewhat more expressive of a complex algorithm than
. It's often helpful to have a number of syntax alternatives for expressing complex processing.
In this chapter, we'll look at the following topics:
wraps()
function in the functools
module; this can help us build decoratorsupdate_wrapper()
function, which may be helpfulChange the font size
Change margin width
Change background colour