mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
22 lines
260 B
Python
22 lines
260 B
Python
class Callable:
|
|
def __init__(self):
|
|
self.count = 0
|
|
|
|
def __call__(self):
|
|
self.count += 1
|
|
return self.count
|
|
|
|
|
|
c = Callable()
|
|
assert 1 == c()
|
|
assert 2 == c()
|
|
|
|
|
|
class Inherited(Callable):
|
|
pass
|
|
|
|
|
|
i = Inherited()
|
|
|
|
assert 1 == i()
|