Browse Source

Random

pull/3/head
Jure Šorn 6 years ago
parent
commit
8496d65d75
1 changed files with 10 additions and 5 deletions
  1. 15
      README.md

15
README.md

@ -489,14 +489,19 @@ creature = Creature()
Closure Closure
------- -------
```python ```python
def multiply_closure(x): def multiply_closure(a):
def wrapped(y): def wrapped(b):
return x * y return a * b
return wrapped return wrapped
```
multiply_by_3 = multiply_closure(3) ```python
>>> multiply_by_3 = multiply_closure(3)
>>> multiply_by_3(10)
30
``` ```
#### Or: #### Or:
```python ```python
from functools import partial from functools import partial

|||||||
100:0
Loading…
Cancel
Save