micropython

Annotated tests/attributes_class_bind_function_inherited.py

655:c52c50dca9dc
2013-05-01 Paul Boddie Added some tests of dynamic attribute access using getattr and string constants. syspython-as-target
paul@219 1
#!/usr/bin/env python
paul@219 2
paul@339 3
def f(self, x):
paul@219 4
    return x
paul@219 5
paul@219 6
class C:
paul@339 7
    e = f
paul@219 8
paul@219 9
class E(C):
paul@219 10
    # e = C.e (via inheritance)
paul@219 11
    pass
paul@219 12
paul@219 13
e = E()
paul@219 14
r = e.e # bound E.e
paul@228 15
result_321 = r(321)
paul@219 16
paul@219 17
# vim: tabstop=4 expandtab shiftwidth=4