micropython

tests/attributes1.py

207:79f8d72c8c78
2009-05-01 Paul Boddie Removed the instance attribute from DataObject (the common data structure), employing the presence of a value on the attrcode attribute to indicate the instance status of objects.
     1 #!/usr/bin/env python     2      3 class C:     4     clsattr = 123     5      6     def __init__(self, value):     7         self.instattr = value     8         self.clsattr     9     10     def update(self, value):    11         self.attr = value    12         C.clsattr    13     14 C    15 C.clsattr    16 C(456).update(789)    17     18 # vim: tabstop=4 expandtab shiftwidth=4