[Python-Dev] slice subscripts for sequences and mappings
Eli Bendersky
eliben at gmail.com
Sat Mar 3 09:50:06 CET 2012
> This doesn't align well with the documentation, in at least two places.
>
<snip>
Another place is in http://docs.python.org/dev/reference/datamodel.html:
"
object.__getitem__(self, key)
Called to implement evaluation of self[key]. For sequence types,
the accepted keys should be integers and slice objects. [...]
"
Once again, at the C API level this isn't accurate since only integer
keys are handled by the sequence protocol, leaving slice keys to the
mapping protocol.
The datamodel doc should stay as it is, because it's correct for
Python-written classes. But the relevant C API sections really need
some clarification.
Eli
More information about the Python-Dev
mailing list