Lichen

tests/numbers.py

318:feefdbfb5934
2016-12-05 Paul Boddie Encode type attributes explicitly, avoiding identification issues when classes are defined in locations that are reused for other objects.
     1 import sys     2      3 print sys.maxint     4 print sys.minint     5      6 print sys.maxint + sys.minint     7      8 i = 2 ** 30     9 print i                                 # 1073741824    10     11 j = -2 ** 30    12 print j                                 # -1073741824    13     14 print i + j                             # 0    15     16 try:    17     print i - j    18 except OverflowError:    19     print "i - j: overflow occurred"    20     21 print i / i                             # 1    22 print i / j                             # -1    23 print j / j                             # 1    24 print j / i                             # -1    25     26 try:    27     print i * j    28 except OverflowError:    29     print "i * j: overflow occurred"    30     31 print i - i                             # 0    32 print j - j                             # 0    33 print ~j                                # 1073741823    34 print i & ~j                            # 0    35 print i - 1 & ~j                        # 1073741823