6
为什么Python3中没有xrange函数?
最近,我开始使用Python3,它缺少xrange的好处。 简单的例子: 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 …
273
python
python-3.x
pep
xrange