pikapython/test/python/callback/class_getattr.py

14 lines
143 B
Python

class Test:
val = 1
def cb(self):
print(self.val)
self.val += 1
t = Test()
fn = getattr(t, 'cb')
fn()
print(t.val)