micropython

tests/attributes_instance_assignment_on_self.py

530:0f9aa4c4d92c
2012-06-09 Paul Boddie Added an __iter__ method for strings.
     1 #!/usr/bin/env python     2      3 class C:     4     def __init__(self, x):     5         self.x = x     6         self.z = None     7      8     def f(self, a):     9         if self.z:    10             pass    11         self.x = a    12     13 class D:    14     def __init__(self, y):    15         self.y = y    16         self.z = None    17     18     def g(self, a):    19         if self.z:    20             self.x    21         self.z = a    22     23 c = C(1)    24 d = D(2)    25 c.f(3)    26 d.g(4)    27 result_3 = c.x    28 result_4 = d.z    29     30 # vim: tabstop=4 expandtab shiftwidth=4