[Python-Dev] __index__ clipping

Travis E. Oliphant oliphant.travis at ieee.org
Fri Aug 11 06:07:57 CEST 2006


Guido van Rossum wrote:
> Thanks for your understanding.
> 
> Anyway, Nick's patch differs in at least one significant way from my
> proposal -- (10**10).__index__() returns sys.maxint in his patch,
> while I want it to return 10000000000L. So this is still an open
> issue.
>

I've reviewed Nick's patch and finally see the light for the need of 
nb_index to return a Python object.  It also nicely parallels nb_int and 
nb_long so the same code can often be used (when it's appropriate for 
the object to be an integer).

I understand the general rationale for the C-API, but I share 
reservations about using output arguments to convey error information. 
This seems quite a bit different from what Python normally does.

I am going to beef up PEP-357 to address the main problem of nb_index 
returning a Py_ssize_t and then look at the C-API question more closely.

I'm also going out of town next week (and have a bunch to prepare for 
it) so I'll only have a few hours to look at it.

-Travis




More information about the Python-Dev mailing list