2020-07-16 | Paul Boddie | raw annotate files changeset graph | Fixed int limit macros by actually using the size of the int type. For wider types such as long, which may be usable on 64-bit platforms in place of int, 1L would need to be used instead of 1 in the calculation. An abstract native integer type might be introduced here and to the native library to allow wider types if appropriate. |
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