micropython

Annotated tests/reference/classes.py

187:9ae98b889fe7
2009-02-22 Paul Boddie Changed inspected context details to more accurately reflect the current policy. Added more precise documentation about contexts, assignments and accesses. Expanded the tests and reference programs around context behaviour. Split the addition tests into more precise programs. Fixed the RSVP integer addition result and instance tests. Added a -m option to the test program to make an RSVP machine immediately.
paul@187 1
#!/usr/bin/env python
paul@187 2
paul@187 3
class B:
paul@187 4
    pass
paul@187 5
paul@187 6
class A:
paul@187 7
    c0 = B
paul@187 8
paul@187 9
            # context on A attribute  context on a attribute
paul@187 10
A.c0        # none                    none
paul@187 11
A.c1 = B    # none                    none
paul@187 12
a = A()
paul@187 13
a.c2 = B    # N/A                     none
paul@187 14
paul@187 15
# vim: tabstop=4 expandtab shiftwidth=4