micropython

tests/attributes2.py

208:eb7b56b0caa3
2009-05-01 Paul Boddie Added extra temporary storage to frames in order to let instantiators expand frames backwards when adding instances to revised frames. Simplified the AdjustFrame instruction, adding such an instruction at the end of instantiator functions. Reorganised the method invocation tests. Added an empty native function for object initialisation.
     1 #!/usr/bin/env python     2      3 def e(x): pass     4      5 class C:     6     e = e     7      8     def test(self):     9         self.e()    10     11 class D:    12     e = C.e    13     14     def test(self):    15         self.e(1) # TypeError: unbound C.e needs C instance, not int    16     17 class E(C):    18     # e = C.e (via inheritance)    19     20     def test(self):    21         self.e()    22     23 c = C()    24 d = D()    25 e = E()    26     27 p = c.e # bound C.e    28 q = d.e # unbound C.e    29 r = e.e # bound E.e    30     31 # vim: tabstop=4 expandtab shiftwidth=4