[Python-Dev] non-integer slice indices?

Skip Montanaro skip@mojam.com (Skip Montanaro)
Fri, 11 Feb 2000 14:42:44 -0600


Viorel Preoteasa asked on python-help today about supporting slices with
non-integer indexes, e.g.:

    foo['a':'abc'] = some_sequence

Currently the Python interpreter (in the slice_index function of ceval.c)
enforces integer slice indices.  I won't pretend to provide motivation for
non-integral slice indices.  Instead, I've CC'd Viorel and will let him
chime in if he feels the need.  It does seem to me that if the __setslice__
programmer is willing to do the type checking and provide the semantics of
"from X to Y" for aribtrary X and Y that the interpreter should let
non-integer indices pass.

Skip Montanaro | http://www.mojam.com/
skip@mojam.com | http://www.musi-cal.com/
"Languages that change by catering to the tastes of non-users tend not to do
so well." - Doug Landauer