[Python-ideas] [Python-Dev] Inclusive Range
alexander.belopolsky at gmail.com
Tue Oct 5 16:33:14 CEST 2010
On Tue, Oct 5, 2010 at 9:16 AM, Michael Foord <fuzzyman at voidspace.org.uk> wrote:
> ... Perhaps I should have been clearer; it is only the
> behaviour of range(x, y) that I've found people-new-to-python confused by.
Teach them about range(x, y, z) and once you cover negative z they
will stop complaining about range(x, y). :-)
At least you don't have to deal with range vs. xrange in 3.x anymore.
IMO, range([start,] stop[, step]) is one of the worst interfaces in
python. Is there any other function with an optional *first*
argument? Why range(date(2010, 1, 1), date(2010, 2, 1), timedelta(1))
cannot be used to produce days in January? Why range(2**300)
succeeds, but len(range(2**300)) raises OverflowError?
No, I don't think much can be done about it. Py3k has already done
everything that was practical about improving range(..).
More information about the Python-ideas