2012-06-04 | Paul Boddie | raw annotate files changeset graph | Updated the documentation to reflect class attribute assignment policies. Added tests to demonstrate class attribute rebinding. |
1 #!/usr/bin/env python 2 3 a = 1 4 b = 2 5 6 class X: 7 def __eq__(self, other): 8 return 0 9 def __ne__(self, other): 10 return 1 11 12 x = X() 13 14 result_1 = 0 15 result_2 = 2 16 result_3 = 3 17 result_4 = 0 18 19 if a != x != b: 20 result_1 = 1 21 22 if a == x != b: 23 result_2 = 0 24 25 if a == x: 26 result_3 = 0 27 28 if a != x: 29 result_4 = 4 30 31 # vim: tabstop=4 expandtab shiftwidth=4