A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-February/061305.html below:

[Python-Dev] Please comment on PEP 357 -- adding nb_index slot to PyNumberMethods

[Python-Dev] Please comment on PEP 357 -- adding nb_index slot to PyNumberMethods [Python-Dev] Please comment on PEP 357 -- adding nb_index slot to PyNumberMethodsTravis Oliphant oliphant.travis at ieee.org
Sat Feb 18 00:38:16 CET 2006
Thomas Wouters wrote:
> On Fri, Feb 17, 2006 at 05:29:32PM +0100, Armin Rigo wrote:
> 
>>>       Where obj must be either an int or a long or another object that has the
>>>       __index__ special method (but not self).
> 
> 
>>The "anything but not self" rule is not consistent with any other
>>special method's behavior.  IMHO we should just do the same as
>>__nonzero__():

Agreed.  I implemented the code, then realized this possible recursion 
problem while writing the specification.  I didn't know how it would be 
viewed.

It is easy enough to require __index__ to return an actual Python 
integer because for anything that has the nb_index slot you would just 
return obj.__index__()  instead of obj.

I'll change the PEP and the implementation.  I have an updated 
implementation that uses the ssize_t patch instead.

There seem to be some issues with the ssize_t patch still, though.

Shouldn't a lot of checks for INT_MAX be replaced with PY_SSIZE_T_MAX. 
But, I noticed that PY_SSIZE_T_MAX definition in pyport.h raises errors.
I don't think it even makes sense.

-Travis

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4