[Python-Dev] Bad interaction of __index__ and sequence repeat

Nick Coghlan ncoghlan at gmail.com
Tue Aug 1 13:00:33 CEST 2006


Travis Oliphant wrote:
>> Probably the most interesting thing now would be for Travis to review 
>> it, and see whether it makes things easier to handle for the Numeric 
>> scalar types (given the amount of code the patch deleted from the 
>> builtin and standard library data types, hopefully the benefits to 
>> Numeric will be comparable).
> 
> 
> I noticed most of the checks for PyInt where removed in the patch.  If I 
> remember correctly, I left these in for "optimization."   Other than 
> that, I think the patch is great.

You're right - there was a fast path based on PyInt_Check in 
_PyEval_SliceIndex that got lost, which I'll add back in. I'll also add fast 
paths for PyInt_Check to the functions in abstract.c, too.

The other PyInt_Check's (in slot_nb_index and instance_index) were there to 
check that __index__ returned the right thing. The check was still there in 
slot_nb_index, but I'd incorrectly removed it from instance_index. I'll add 
that one back in, too.

Once that's done, I'll update the tracker item and reassign to Tim for a review.

Cheers,
Nick.

> As far as helping with NumPy,  I think it will help to be able to remove 
> special-checks for all the different integer-types.  But, this has not 
> yet been done in the NumPy code.
> 
> -Travis
> 
> 
> 


-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-Dev mailing list