2014-03-17 | Paul Boddie | file changeset files shortlog | Added a note about the _attr annotation and unresolved names. | syspython-as-target |
paul@782 | 1 | #!/usr/bin/env python |
paul@782 | 2 | |
paul@782 | 3 | class C: |
paul@782 | 4 | def __init__(self, a): |
paul@782 | 5 | self.a = a |
paul@782 | 6 | |
paul@786 | 7 | class D: |
paul@786 | 8 | def __init__(self, a): |
paul@786 | 9 | self.a = a |
paul@786 | 10 | self.b = 0 |
paul@786 | 11 | |
paul@782 | 12 | def f(obj, b): |
paul@786 | 13 | # Should fail when isinstance(obj, C). |
paul@782 | 14 | obj.b = b |
paul@782 | 15 | |
paul@782 | 16 | c = C(1) |
paul@786 | 17 | # Should fail due to subsequent usage. |
paul@786 | 18 | d = D(3) |
paul@782 | 19 | f(c, 2) |
paul@782 | 20 | result_1 = c.a |
paul@782 | 21 | result_2 = c.b |
paul@782 | 22 | |
paul@782 | 23 | # vim: tabstop=4 expandtab shiftwidth=4 |