circuitpython/tests/basics/class_call.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
241 B
Python
Raw Permalink Normal View History

2014-04-25 14:15:16 -04:00
class C1:
def __call__(self, val):
print('call', val)
return 'item'
class C2:
def __getattr__(self, k):
pass
c1 = C1()
print(c1(1))
c2 = C2()
try:
print(c2(1))
except TypeError:
print("TypeError")