Strange range

Random832 random832 at fastmail.com
Sun Apr 3 01:20:52 EDT 2016


On Sun, Apr 3, 2016, at 00:43, Steven D'Aprano wrote:
> If you personally don't see any advantage in this, so be it, but you
> might
> not be aware of the history of (x)range:
> 
> Guido in 2001: "Nobody uses this extra functionality, and its buggy,
> let's
> get rid of it."
> 
> https://www.python.org/dev/peps/pep-0260/

Several of those features apparently never did come back. The repeat
count never did (you can't multiply ranges now), and it occurs to me
that slicing a range that has a repeat count is intractable:
(range(3)*2)[1:5] should yield 1, 2, 0, 1, which can't be represented as
a range object. It also doesn't support comparison operations.



More information about the Python-list mailing list