Python includes several modules for implementing algorithms elegantly and concisely using whatever style is most appropriate for the task. It supports purely procedural, object-oriented, and functional styles, and all three styles are frequently mixed within different parts of the same program.
functools (page 143) includes functions for creating function decorators, enabling aspect-oriented programming and code reuse beyond what a traditional object-oriented approach supports. It also provides a class decorator for implementing all of the rich comparison APIs using a shortcut, and
partial objects for creating references to functions with their arguments included.
itertools (page 163) module includes functions for creating ...