2014-03-09 | Paul Boddie | raw files shortlog changelog graph | Added another example illustrating that attributes must be defined "internally" at least once in order to be associated with a class. | syspython-as-target |
tests/failure/attributes_instance_assignment_external_only_indirect.py (file) |
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/tests/failure/attributes_instance_assignment_external_only_indirect.py Sun Mar 09 18:26:17 2014 +0100 1.3 @@ -0,0 +1,16 @@ 1.4 +#!/usr/bin/env python 1.5 + 1.6 +class C: 1.7 + def __init__(self, a): 1.8 + self.a = a 1.9 + 1.10 +def f(obj, b): 1.11 + obj.a 1.12 + obj.b = b 1.13 + 1.14 +c = C(1) 1.15 +f(c, 2) 1.16 +result_1 = c.a 1.17 +result_2 = c.b 1.18 + 1.19 +# vim: tabstop=4 expandtab shiftwidth=4