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

2006-02-17 Thread Georg Brandl
Bernhard Herzog wrote: Travis E. Oliphant [EMAIL PROTECTED] writes: 2) The __index__ special method will have the signature def __index__(self): return obj Where obj must be either an int or a long or another object that has the __index__

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

2006-02-17 Thread Nick Coghlan
Georg Brandl wrote: Bernhard Herzog wrote: Travis E. Oliphant [EMAIL PROTECTED] writes: 2) The __index__ special method will have the signature def __index__(self): return obj Where obj must be either an int or a long or another object that has

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

2006-02-17 Thread Armin Rigo
Hi Travis, On Tue, Feb 14, 2006 at 08:41:19PM -0700, Travis E. Oliphant wrote: 2) The __index__ special method will have the signature def __index__(self): return obj Where obj must be either an int or a long or another object that has the

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

2006-02-17 Thread Thomas Wouters
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

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

2006-02-17 Thread Travis Oliphant
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

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

2006-02-15 Thread Nick Coghlan
Travis E. Oliphant wrote: 3) A new C-API function PyNumber_Index will be added with signature Py_ssize_t PyNumber_index (PyObject *obj) There's a typo in the function name here. Other than that, the PEP looks pretty much fine to me. About the only other quibble is that it could

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

2006-02-14 Thread Travis E. Oliphant
After some revisions, PEP 357 is ready for more comments. Please voice any concerns. -Travis PEP: 357 Title: Allowing Any Object to be Used for Slicing Version: $Revision: 42367 $ Last Modified: $Date: 2006-02-14 18:12:07 -0700 (Tue, 14 Feb 2006) $ Author: Travis Oliphant [EMAIL PROTECTED]