2012-06-03 | Paul Boddie | raw annotate files changeset graph | Restricted attribute assignments observed through usage analysis to instance attributes only. |
1 #!/usr/bin/env python 2 3 class C: 4 def __init__(self, x): 5 self.x = x 6 7 a = [C(1), C(2), C(3)] 8 b = [x.x for x in a] 9 c = [x.x for x in a if x.x > 1] 10 11 result1_1 = b[0] 12 result1_2 = b[1] 13 result1_3 = b[2] 14 result2_2 = c[0] 15 result2_3 = c[1] 16 17 # vim: tabstop=4 expandtab shiftwidth=4