Browse Source

Closure

pull/10/head
Jure Šorn 6 years ago
parent
commit
658af1badb
1 changed files with 2 additions and 1 deletions
  1. 3
      README.md

3
README.md

@ -538,7 +538,7 @@ Closure
-------
**We have a closure in Python when:**
* **A nested function references a value of its enclosing function, and then**
* **the enclosing function returns the nested function.
* **the enclosing function returns the nested function.**
```python
def get_multiplier(a):
@ -554,6 +554,7 @@ def get_multiplier(a):
```
* **If multiple nested functions within enclosing function reference the same value, that value gets shared.**
* **To dynamicaly acces functions first free variable use `'<function>.__closure__[0].cell_contents`'.**
#### Or:
```python

Loading…
Cancel
Save