[Python-Dev] PEP for adding an sq_index slot so that any object, a or b, can be used in X[a:b] notation
Brett Cannon
brett at python.org
Thu Feb 9 18:42:44 CET 2006
On 2/9/06, Travis Oliphant <oliphant.travis at ieee.org> wrote:
>
> Guido seemed accepting to this idea about 9 months ago when I spoke to
> him. I finally got around to writing up the PEP. I'd really like to
> get this into Python 2.5 if possible.
>
> -Travis
>
>
>
>
> PEP: ###
> Title: Allowing any object to be used for slicing
Overally I am fine with the idea. Being used as an index is different
than coercion into an int so adding this extra method seems
reasonable.
> Implementation Plan
>
> 1) Add the slots
>
> 2) Change the ISINT macro in ceval.c to accomodate objects with the
> index slot defined.
>
Maybe the macro should also be renamed? Not exactly testing if
something is an int anymore if it checks for __index__.
> 3) Change the _PyEval_SliceIndex function to accomodate objects
> with the index slot defined.
>
-Brett
More information about the Python-Dev
mailing list