Why is there no xrange function in Python3?
问题 Recently I started using Python3 and it\'s lack of xrange hurts. Simple example: 1) Python2: from time import time as t def count(): st = t() [x for x in xrange(10000000) if x%4 == 0] et = t() print et-st count() 2) Python3: from time import time as t def xrange(x): return iter(range(x)) def count(): st = t() [x for x in xrange(10000000) if x%4 == 0] et = t() print (et-st) count() The results are, respectively: 1) 1.53888392448 2) 3.215819835662842 Why is that? I mean, why xrange\'s been