[Python-ideas] Inclusive Range

Masklinn masklinn at masklinn.net
Wed Oct 6 16:36:35 CEST 2010


On 2010-10-06, at 15:58 , Nick Coghlan wrote:
> *(unfortunately, it's a bit trickier to mesh that otherwise clear and
> concise explanation cleanly with Python's definition of ranges and
> slicing with negative step values, since those offset everything by
> one, such that "list(reversed(range(1, 5, 1])) == list(range(4, 0,
> -1])".
I'm not sure about that at all: the index is still right before the item, which is why the last item is `-1` rather than `-0`. And everything flows from that again.




More information about the Python-ideas mailing list