[Python-3000] range() issues
Nick Coghlan
ncoghlan at gmail.com
Thu May 1 01:11:23 CEST 2008
Greg Ewing wrote:
> Guido van Rossum wrote:
>> I would like to see the following:
>>
>> - sq_length should return maxsize if the actual value doesn't fit
>
> So that code will silently behave as though the rest of
> the sequence wasn't there some of the time?
>
> Can you elaborate on the rationale for this? I'm having
> trouble seeing how it's a good idea.
>
Yeah, it sounds more like behaviour I would expect from __length_hint__,
not __length__.
In the bug tracker, Alexander mentioned the possibility of removing
__length__ and __getitem__ support from range() objects in py3k, and
implementing only __length_hint__ instead (leaving range() as a
bare-bones iterable). I'm starting to like that idea more and more.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-3000
mailing list