Re: [Python-Dev] __index__ clipping

2006-08-11 Thread Travis E. Oliphant
Travis E. Oliphant wrote: Here is my C-API proposal 1) PyIndex_Check(obj) Similar to PyIter_Check(obj) as it just checks for whether or not the object can call nb_index. Actually implemented as a macro. 2) PyObject* PyNumber_Index(obj) Simple interface around nb_index that

Re: [Python-Dev] __index__ clipping

2006-08-11 Thread Nick Coghlan
Travis E. Oliphant wrote: Travis E. Oliphant wrote: Here is my C-API proposal 1) PyIndex_Check(obj) Similar to PyIter_Check(obj) as it just checks for whether or not the object can call nb_index. Actually implemented as a macro. 2) PyObject* PyNumber_Index(obj) Simple interface

Re: [Python-Dev] __index__ clipping

2006-08-10 Thread Nick Coghlan
Guido van Rossum wrote: It seems like Nick's recent patches solved the problems that were identified. Nick, can you summarize how your patches differ from my proposal? nb_index and __index__ are essentially exactly as you propose. To make an object implemented in C usable as an index you

Re: [Python-Dev] __index__ clipping

2006-08-10 Thread Nick Coghlan
Guido van Rossum wrote: On 8/10/06, Nick Coghlan [EMAIL PROTECTED] wrote: Guido van Rossum wrote: It seems like Nick's recent patches solved the problems that were identified. Nick, can you summarize how your patches differ from my proposal? nb_index and __index__ are essentially

Re: [Python-Dev] __index__ clipping

2006-08-10 Thread Travis E. Oliphant
Guido van Rossum wrote: On 8/10/06, Nick Coghlan [EMAIL PROTECTED] wrote: Guido van Rossum wrote: It seems like Nick's recent patches solved the problems that were identified. Nick, can you summarize how your patches differ from my proposal? nb_index and __index__ are essentially exactly as

Re: [Python-Dev] __index__ clipping

2006-08-10 Thread Guido van Rossum
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 100L. So this is still an open issue. --Guido On 8/10/06, Travis E. Oliphant [EMAIL PROTECTED]

Re: [Python-Dev] __index__ clipping

2006-08-10 Thread Travis Oliphant
Guido van Rossum wrote: What do you think (10**10).__index__() should return (when called from Python)? I'm with Guido on this point. I think (10**10).__index__() should return the full long integer when called from within Python. -Travis ___

Re: [Python-Dev] __index__ clipping

2006-08-10 Thread Guido van Rossum
(adding back python-dev in the CC: list) Right. I guess I didn't recompile after patching. Silly me (as Orlijn would say :-). Neal+Anthony, do you need me to review Nick's patch? If I don't have to I'd rather pay more attention to py3k, which I've sadly neglected in the past month (apart from

[Python-Dev] __index__ clipping

2006-08-09 Thread Guido van Rossum
Here's another issue where Neal thought it would be useful if I weighed in. I'm not quite sure of the current status, but perhaps the following would work? - Called from Python, (10**10).__index__() should return 100L, not raise an exception or return sys.maxint. - The nb_index slot is

Re: [Python-Dev] __index__ clipping

2006-08-09 Thread Travis E. Oliphant
Guido van Rossum wrote: Here's another issue where Neal thought it would be useful if I weighed in. I'm not quite sure of the current status, but perhaps the following would work? - Called from Python, (10**10).__index__() should return 100L, not raise an exception or return

Re: [Python-Dev] __index__ clipping

2006-08-09 Thread Guido van Rossum
On 8/9/06, Travis E. Oliphant [EMAIL PROTECTED] wrote: Guido van Rossum wrote: Here's another issue where Neal thought it would be useful if I weighed in. I'm not quite sure of the current status, but perhaps the following would work? - Called from Python, (10**10).__index__() should