[Python-Dev] Please comment on PEP 357 -- adding nb_index slot to PyNumberMethods (original) (raw)
Travis Oliphant oliphant.travis at ieee.org
Sat Feb 18 00:38:16 CET 2006
- Previous message: [Python-Dev] Please comment on PEP 357 -- adding nb_index slot to PyNumberMethods
- Next message: [Python-Dev] str object going in Py3K
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Python-Dev] Please comment on PEP 357 -- adding nb_index slot to PyNumberMethods
- Next message: [Python-Dev] str object going in Py3K
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]