Strange range
Random832
random832 at fastmail.com
Fri Apr 1 10:39:45 EDT 2016
On Fri, Apr 1, 2016, at 10:12, Marko Rauhamaa wrote:
> Yes, I realize it now. I had thought it was:
>
> def range(start, end=None, step=1):
> if end is None:
> start, end = 0, start
> i = start
> while step * (end - i) > 0:
> yield i
> i += step
You know the other funny thing? Even people who understand this about
Python 3 ranges, many assume that python 2 xrange was more similar to
your latter example (possibly caused by the fact that python 2 had other
things such as dict.iteritems which _were_ mere iterators)
More information about the Python-list
mailing list