[issue2690] Precompute range length

Guido van Rossum report at bugs.python.org
Thu Jul 31 19:39:32 CEST 2008


Guido van Rossum <guido at python.org> added the comment:

On the issue of whether len(range()) should be allowed to be >
sys.maxsize, I think this should be allowed.  I think in the future we
should change the __len__ protocol to allow unbounded lengths.  Even
today, I think range(10**100).__len__() should return 10**100 rather
than raising an OverflowError, even if len(range(10**100)) raises
OverflowError.

I also think ranges should be introspectable, exposing their start, stop
and step values just like slice objects.

Probably all those changes are for post 3.0.

----------
nosy: +gvanrossum

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2690>
_______________________________________


More information about the Python-bugs-list mailing list