2013-10-31 | Paul Boddie | file changeset files shortlog | Added remarks about local namespaces and name usage observations. | syspython-as-target |
paul@427 | 1 | #!/usr/bin/env python |
paul@427 | 2 | |
paul@427 | 3 | class C: |
paul@427 | 4 | def __init__(self): |
paul@427 | 5 | self.a = 0 |
paul@427 | 6 | |
paul@427 | 7 | class D: |
paul@427 | 8 | def __init__(self): |
paul@427 | 9 | self.a = 1 |
paul@427 | 10 | |
paul@427 | 11 | def f(obj, value): |
paul@427 | 12 | obj.a = value |
paul@427 | 13 | |
paul@427 | 14 | c = C() |
paul@427 | 15 | d = D() |
paul@427 | 16 | f(c, 123) |
paul@427 | 17 | f(d, 456) |
paul@427 | 18 | result_123 = c.a |
paul@427 | 19 | result_456 = d.a |
paul@427 | 20 | |
paul@427 | 21 | # vim: tabstop=4 expandtab shiftwidth=4 |