2016-12-07 | Paul Boddie | raw annotate files changeset graph | Added support for reading to the end of a stream's input, fixing EOFError raising in fread by returning shorter amounts of data when EOF occurs, only raising an exception if no data was read before EOF occurred. Made the test input longer to exercise tests of reading remaining data. |
1 l = range(0, 10) 2 print l # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] 3 print len(l) # 10 4 5 x = xrange(0, -10, -2) 6 print x # __builtins__.span.xrange(0, -10, -2) 7 print len(x) # 5 8 9 for i in x: 10 print i # 0 11 # -2 12 # -4 13 # -6 14 # -8 15 16 x = xrange(0, -10, 2) 17 print x # __builtins__.span.xrange(0, 0, 2) 18 print len(x) # 0