micropython

tests/compare_membership.py

519:814bd122d84d
2012-06-04 Paul Boddie 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      5 class X:     6     def __contains__(self, other):     7         return 1     8      9 x = X()    10     11 result_5 = 0    12 result_6 = 6    13     14 if a in x:    15     result_5 = 5    16     17 if a not in x:    18     result_6 = 0    19     20 # vim: tabstop=4 expandtab shiftwidth=4