Skip to content

Commit 067b665

Browse files
committed
Class
1 parent 3f37b83 commit 067b665

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ from functools import partial
582582

583583
```python
584584
def get_counter():
585-
a = 1
585+
a = 0
586586
def out():
587587
nonlocal a
588588
a += 1
@@ -722,11 +722,12 @@ class MySequence:
722722

723723
### Callable
724724
```python
725-
class MyCallable:
726-
def __init__(self, a):
727-
self.a = a
725+
class Counter:
726+
def __init__(self):
727+
self.a = 0
728728
def __call__(self):
729-
return a
729+
self.a += 1
730+
return self.a
730731
```
731732

732733
### Copy

0 commit comments

Comments
 (0)