micropython

Annotated tests/getattr_instance_methods.py

634:c1c95a183e21
2013-01-14 Paul Boddie Moved common logic into a separate method.
paul@413 1
#!/usr/bin/env python
paul@413 2
paul@413 3
class C:
paul@413 4
    def x(self):
paul@413 5
        return 1
paul@413 6
paul@413 7
class D:
paul@413 8
    def x(self):
paul@413 9
        return 2
paul@413 10
paul@413 11
c = C()
paul@413 12
d = D()
paul@413 13
result_1 = getattr(c, "x")()
paul@413 14
result_2 = getattr(d, "x")()
paul@413 15
paul@413 16
# vim: tabstop=4 expandtab shiftwidth=4