We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent abdb6bc commit 2b11ea9Copy full SHA for 2b11ea9
README.md
@@ -536,6 +536,10 @@ creature = Creature()
536
537
Closure
538
-------
539
+**We have a closure in Python when:**
540
+* **A nested function references a value of its enclosing function, and then**
541
+* **the enclosing function returns the nested function.
542
+
543
```python
544
def get_multiplier(a):
545
def out(b):
@@ -549,6 +553,8 @@ def get_multiplier(a):
549
553
30
550
554
```
551
555
556
+* **If multiple nested functions within enclosing function reference the same value, that value gets shared.**
557
552
558
#### Or:
559
560
from functools import partial
0 commit comments