Files
RustPython/extra_tests/snippets/protocol_callable.py
2022-05-04 02:54:59 +09:00

19 lines
259 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()