2012-02-27 | Paul Boddie | file changeset files shortlog | Added general attribute usage recording for attribute assignments on self, even though specific attribute usage is also recorded. This prevents usage from being inadvertently incomplete. Added tests demonstrating the contribution of attribute assignments to usage observations. |
paul@242 | 1 | #!/usr/bin/env python |
paul@242 | 2 | |
paul@242 | 3 | import imported |
paul@242 | 4 | |
paul@242 | 5 | class C: # hack: make an attribute called y known to the system |
paul@242 | 6 | y = None # hack: this prevents compilation errors with the statements |
paul@242 | 7 | # hack: below |
paul@242 | 8 | |
paul@242 | 9 | n = None |
paul@242 | 10 | n = imported |
paul@242 | 11 | n.a = 1 # not detected due to reassignment of n |
paul@242 | 12 | n.y = 2 # not detected due to reassignment of n |
paul@242 | 13 | n.y = 3 # not detected due to reassignment of n |
paul@242 | 14 | |
paul@242 | 15 | # vim: tabstop=4 expandtab shiftwidth=4 |