2013-01-15 | Paul Boddie | file changeset files shortlog | Added support for multiple class definitions in the same namespace with the same name. Made classes attribute users. |
paul@575 | 1 | #!/usr/bin/env python |
paul@575 | 2 | |
paul@575 | 3 | class C: |
paul@575 | 4 | p = 123 |
paul@575 | 5 | |
paul@575 | 6 | class D: |
paul@575 | 7 | p = 456 |
paul@575 | 8 | |
paul@575 | 9 | x = C |
paul@575 | 10 | |
paul@575 | 11 | def change(): |
paul@575 | 12 | global x |
paul@575 | 13 | x = D |
paul@575 | 14 | |
paul@576 | 15 | def use(y): |
paul@576 | 16 | return y.p # usage of p |
paul@576 | 17 | |
paul@575 | 18 | def f(): |
paul@576 | 19 | return x.p # ambiguous |
paul@575 | 20 | |
paul@575 | 21 | change() |
paul@575 | 22 | result1_456 = x.p |
paul@575 | 23 | result2_456 = f() |
paul@576 | 24 | result3_456 = use(x) |
paul@575 | 25 | |
paul@575 | 26 | # vim: tabstop=4 expandtab shiftwidth=4 |