micropython

tests/isinstance.py

515:20ea2e9b841d
2012-06-03 Paul Boddie Restricted attribute assignments observed through usage analysis to instance attributes only.
     1 #!/usr/bin/env python     2      3 result_1 = 0     4 result_2 = 0     5 result_3 = 0     6 result_4 = 0     7 result_5 = 0     8 result_6 = 0     9     10 if isinstance(1, int):    11     result_1 = 1    12     13 if isinstance("", str):    14     result_2 = 2    15     16 if isinstance((1, 2, 3), tuple):    17     result_3 = 3    18     19 if isinstance((1, 2, 3), (int, tuple)):    20     result_4 = 4    21     22 if not isinstance(1, (str, tuple)):    23     result_5 = 5    24     25 if isinstance(tuple, type):    26     result_6 = 6    27     28 # vim: tabstop=4 expandtab shiftwidth=4