Lichen

tests/for.py

934:2989aab1b4f7
7 months ago Paul Boddie Renamed the utf8string class to unicode, eliminating the unicode function. This means that the simple case of merely returning an object if it is already a Unicode object no longer occurs when using the unicode callable, but such behaviour might be better supported with more general customised instantiation functionality.
     1 l = [1, 2, 3]     2      3 # Test else clause.     4      5 for i in l:     6     print i             # 1     7                         # 2     8                         # 3     9 else:    10     print 4             # 4    11     12 # Test break versus else clause.    13     14 for i in l:    15     print i             # 1    16                         # 2    17     if i == 2:    18         break    19 else:    20     print 3    21     22 # Test StopIteration in loop.    23     24 try:    25     for i in l:    26         print i         # 1    27                         # 2    28         if i == 2:    29             raise StopIteration    30     else:    31         print 3    32     33 except StopIteration:    34     print "stopped"     # stopped