2012-06-04 | Paul Boddie | file changeset files shortlog | Updated the documentation to reflect class attribute assignment policies. Added tests to demonstrate class attribute rebinding. |
paul@519 | 1 | #!/usr/bin/env python |
paul@519 | 2 | |
paul@519 | 3 | class C: |
paul@519 | 4 | e = 123 |
paul@519 | 5 | |
paul@519 | 6 | class F: |
paul@519 | 7 | def __init__(self): |
paul@519 | 8 | self.e = 789 |
paul@519 | 9 | |
paul@519 | 10 | def f(obj): |
paul@519 | 11 | obj.e = 456 # should rebind C.e |
paul@519 | 12 | |
paul@519 | 13 | other = F() |
paul@519 | 14 | f(C) |
paul@519 | 15 | result_456 = C.e |
paul@519 | 16 | |
paul@519 | 17 | # vim: tabstop=4 expandtab shiftwidth=4 |