micropython

Annotated tests/attributes_class_copy.py

655:c52c50dca9dc
2013-05-01 Paul Boddie Added some tests of dynamic attribute access using getattr and string constants. syspython-as-target
paul@223 1
#!/usr/bin/env python
paul@223 2
paul@223 3
class C:
paul@223 4
    clsattr = 123
paul@223 5
    clsattr2 = clsattr
paul@223 6
paul@223 7
x = 0 # prevent optimisation of assignments
paul@223 8
x = C # prevent optimisation of assignments
paul@228 9
result_123 = x.clsattr
paul@228 10
result2_123 = x.clsattr2
paul@223 11
paul@223 12
# vim: tabstop=4 expandtab shiftwidth=4