micropython

tests/attributes_class_assignment_method.py

525:deb3720de7d1
2012-06-05 Paul Boddie Introduced more rigid selection of suitable types depending on whether all attributes given as being used can be found in one or more types, or whether the selection of less satisfactory types (supporting any of the attributes) is necessary.
     1 #!/usr/bin/env python     2      3 class C:     4     def clsattr(self):     5         return 123     6     def clsattr2(self):     7         return 456     8      9 def a(x):    10     return 789    11     12 def b(x):    13     return 234    14     15 C.clsattr = a    16 C.clsattr2 = b    17     18 c = C()    19     20 result_789 = c.clsattr()    21 result_234 = c.clsattr2()    22     23 # vim: tabstop=4 expandtab shiftwidth=4