References#
🏛️ Lecture 5
ENPM605 – L5: Advanced Functions
Covers programming paradigms (procedural, functional, object-oriented), first-class functions, lambda expressions, closures, callables, decorators (basic, stacking, parameterized), functools.wraps, functools.partial, and built-in higher-order functions (map, filter, sorted with key).
🐍 Python Language References
Python HOWTO
Comprehensive guide to functional programming in Python, including iterators, generators, and built-in functional tools.
Python Reference
Syntax and semantics of lambda expressions in Python.
__call__Python Data Model
The __call__ special method that makes instances callable.
callable()Built-in Functions
The callable() function for checking if an object is callable.
functools.partialStandard Library – functools
Creating partial function objects with frozen arguments.
functools.wrapsStandard Library – functools
Preserving function metadata when writing decorators.
Python Glossary
Official definition of decorators in the Python glossary.
PEP 318
The PEP that introduced decorator syntax for functions and methods.
📏 Style and Best Practices
Coding Conventions
Guidelines for function naming, lambda usage, and code formatting.
🌐 External Tutorials
Real Python
Comprehensive tutorial on decorators, including first-class objects, closures, and practical examples.
Real Python
In-depth guide to closures in Python with practical examples.
Real Python
Guide to lambda functions, their syntax, use cases, and limitations.
Real Python
Overview of the functools module including partial, wraps, lru_cache, and more.
Real Python
Introduction to functional programming concepts in Python.
📚 Recommended Reading
Getting Started
Section 4.7.5 (Lambda Expressions) and Section 4.7.6 (Documentation Strings) cover relevant topics for this lecture.
Fluent Python (2nd Edition)
Chapters 7-9 cover first-class functions, type hints, decorators, and closures. Excellent for understanding functions as objects.
Learning Python (5th Edition)
Chapters 19-21 cover advanced function topics including closures, decorators, and functional programming tools.
Effective Python (2nd Edition)
Items 19-26 cover function arguments, return values, closures, and decorators with practical best practices.