Update from Travis -- move to make it a numeric slot.
This commit is contained in:
parent
bc56fb8889
commit
9880d5499b
13
pep-0357.txt
13
pep-0357.txt
|
@ -10,7 +10,7 @@ Python-Version: 2.5
|
||||||
|
|
||||||
Abstract
|
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
|
an __index__ special method so that arbitrary objects can be used
|
||||||
in slice syntax.
|
in slice syntax.
|
||||||
|
|
||||||
|
@ -32,17 +32,18 @@ Rationale
|
||||||
|
|
||||||
Proposal
|
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
|
__index__ special method. Objects could define a function to
|
||||||
place in the sq_index slot that returns an C-integer for use in
|
place in the sq_index slot that returns an appropriate
|
||||||
PySequence_GetSlice, PySequence_SetSlice, and PySequence_DelSlice.
|
C-integer for use as ilow or ihigh in PySequence_GetSlice,
|
||||||
|
PySequence_SetSlice, and PySequence_DelSlice.
|
||||||
|
|
||||||
Implementation Plan
|
Implementation Plan
|
||||||
|
|
||||||
1) Add the slots
|
1) Add the slots
|
||||||
|
|
||||||
2) Change the ISINT macro in ceval.c to accomodate objects with the
|
2) Change the ISINT macro in ceval.c to ISINDEX and alter it to
|
||||||
index slot defined.
|
accomodate objects with the index slot defined.
|
||||||
|
|
||||||
3) Change the _PyEval_SliceIndex function to accomodate objects
|
3) Change the _PyEval_SliceIndex function to accomodate objects
|
||||||
with the index slot defined.
|
with the index slot defined.
|
||||||
|
|
Loading…
Reference in New Issue