Message221724
Memoryview should definitely have the same slice tests as other sequence objects. Go ahead and check.
I believe slice clamping itself should now be done by slice.indices, not by each class.
S.indices(len) -> (start, stop, stride)
Assuming a sequence of length len, calculate the start and stop
indices, and the stride length of the extended slice described by
S. Out of bounds indices are clipped in a manner consistent with the
handling of normal slices.
It seems like this was written before it was normal for every slice to have a step (stride), defaulting to None/1. It definitely comes from 2.x, before __getslice__ was folded into __getitem__
I expect builtin 3.x sequence objects should all use something like the C equivalent of
def __getitem__(self, ob):
if type(ob) is slice:
start, stop, stride = ob.indices(self.len)
... |
|
Date |
User |
Action |
Args |
2014-06-27 20:46:27 | terry.reedy | set | recipients:
+ terry.reedy, vstinner, skrah |
2014-06-27 20:46:27 | terry.reedy | set | messageid: <1403901987.45.0.497176710775.issue21856@psf.upfronthosting.co.za> |
2014-06-27 20:46:27 | terry.reedy | link | issue21856 messages |
2014-06-27 20:46:27 | terry.reedy | create | |
|