[Python-3000] range() issues
Adam Olsen
rhamph at gmail.com
Wed Apr 30 08:15:50 CEST 2008
On Tue, Apr 29, 2008 at 8:36 PM, Guido van Rossum <guido at python.org> wrote:
> Let's also fix __len__() so that it returns sys.{maxint,maxsize} when
> the result doesn't fit in a Py_ssize_t.
Why not leave sq_length as is, but have len() bypass it and call
.__len__() directly? C code is likely allocating memory for whatever
length it's given, so a sq_length overflow just makes it fail earlier,
whereas python code could be more creative (such as printing the
length of an on-disk container.)
The problem with the indexing API also calling sq_length is moot since
you've decided to remove it from range.
--
Adam Olsen, aka Rhamphoryncus
More information about the Python-3000
mailing list