[MATRIX-SIG] Change slice object?
Janko Hauser
jhauser@ifm.uni-kiel.de
Tue, 18 Nov 1997 08:57:35 +0100 (CET)
Chase, Christopher J (Chris), NNAD writes:
> With your suggested change, what would using slice(0,5,None) mean?
> Would that be an error?
I think this should then be an error, but this construct is then not
present, because the default of slice.step should then always be 1.
Is it possible to implement this slice handling only for multiarray
objects?
Uh, I see now that slices can not be used like expected for lists
Python 1.4 (Sep 1 1997) [GCC 2.7.2.1]
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> a=[1,2,3,4,5]
>>> a[slice(0,3,1)]
Traceback (innermost last):
File "<stdin>", line 1, in ?
ValueError: standard sequence type does not support step size other than one
>>> a[slice(0,3)]
Traceback (innermost last):
File "<stdin>", line 1, in ?
ValueError: standard sequence type does not support step size other than one
>>> a[slice(0,3,None)]
Traceback (innermost last):
File "<stdin>", line 1, in ?
ValueError: standard sequence type does not support step size other than one
Is this right?
__Janko
_______________
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________