[Python-3000] range() issues

"Martin v. Löwis" martin at v.loewis.de
Sun Apr 27 02:55:01 CEST 2008


>> lens are forced to be <= Py_ssize_t because that's the limit put on
>>  sequence sizes.
> 
> But this should be a secuence issue... or not?  Why I'm limiting the
> general len()/__len__ infrastructure?

Because a C type is used to represent it, not a Python object. Any
C type (whichever you chose) will have a length restriction.

More specifically, it's because of this definition from object.h:

typedef Py_ssize_t (*lenfunc)(PyObject *);

   ...
   lenfunc sq_length;

If you were asking whether it is good as it is: yes, practicality
beats purity. Being pure here has no real value.


Regards,
Martin


More information about the Python-3000 mailing list