Рет қаралды 23,603
In this Python programming tutorial, we will learn how closures work in Python. We will also see how shared extended scopes and multi-scoped variables are implemented in Python using intermediary cell objects. Understanding closures helps us in understanding other language features like function decorators.
References
------------------
* Python data model: docs.python.org/3/reference/d... - documentation for 'co_*' attributes can be found under "Code objects"
* Cell objects: docs.python.org/3/c-api/cell....
* Dr. Fred Baptiste's course www.udemy.com/course/python-3...
Recommended prerequisite
--------------------------------------------
Variable scopes and Namespaces: • Python tutorial: Varia...
Chapters
---------------
0:00 Prerequisites
0:12 First example code
0:51 Visual representation of first example
2:23 Closure
3:12 second example
4:26 Multiple closure instances
4:51 Comparing with classes
5:25 Shared free variables
5:54 Cell objects
7:01 attributes of function objects