Lichen

tests/string.py

338:61776a5a0e16
2016-12-07 Paul Boddie Associate constant name information with references so that structure members such as function instance default members can be generated statically, thus eliminating unnecessary structure initialisation in the translated code. Improved the determination of dynamic functions in the importer to consider only non-constant defaults.
     1 s = "Hello"     2 s += " world!"     3 print s                     # Hello world!     4      5 s2 = "Hello worlds!"     6 print s2                    # Hello worlds!     7 print s < s2                # True     8 print s <= s2               # True     9 print s == s2               # False    10 print s != s2               # True    11 print s >= s2               # False    12 print s > s2                # False    13     14 print s[0]                  # H    15 print s[-1]                 # !    16     17 print ord(s[0])             # 72    18     19 try:    20     print ord(s)            # should raise an exception    21 except ValueError, exc:    22     print "ord(s): value is not appropriate", exc.value    23     24 print hash(s)