Lichen

tests/numbers.py

360:209dc7a270fd
2016-12-09 Paul Boddie Added support for dynamic attribute access using getattr and hasattr, employing a special attribute on strings to hold the object table code and position for any attribute having the same name as the represented string.
     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