Update from Travis -- move to make it a numeric slot.

This commit is contained in:
Guido van Rossum 2006-02-09 22:26:00 +00:00
parent bc56fb8889
commit 9880d5499b
1 changed files with 8 additions and 7 deletions

View File

@ -10,7 +10,7 @@ Python-Version: 2.5
Abstract
This PEP proposes adding an sq_index slot in PySequenceMethods and
This PEP proposes adding an nb_as_index slot in PyNumberMethods and
an __index__ special method so that arbitrary objects can be used
in slice syntax.
@ -32,17 +32,18 @@ Rationale
Proposal
Add a sq_index slot to PySequenceMethods, and a corresponding
Add a nb_index slot to PyNumberMethods, and a corresponding
__index__ special method. Objects could define a function to
place in the sq_index slot that returns an C-integer for use in
PySequence_GetSlice, PySequence_SetSlice, and PySequence_DelSlice.
place in the sq_index slot that returns an appropriate
C-integer for use as ilow or ihigh in PySequence_GetSlice,
PySequence_SetSlice, and PySequence_DelSlice.
Implementation Plan
1) Add the slots
2) Change the ISINT macro in ceval.c to accomodate objects with the
index slot defined.
2) Change the ISINT macro in ceval.c to ISINDEX and alter it to
accomodate objects with the index slot defined.
3) Change the _PyEval_SliceIndex function to accomodate objects
with the index slot defined.