[Python-3000] Making more effective use of slice objects in Py3k (original) (raw)

Barry Warsaw barry at python.org
Tue Aug 29 04:10:14 CEST 2006


-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

On Aug 28, 2006, at 9:20 PM, Greg Ewing wrote:

I'm also not all that happy about forcing slice indices to be ints. Traditionally they are, but someone might want to define a class that uses them in a more general way.

In fact, we do. Our application is simulated execution of source
code, so there are cases where we have multiple values due to
indeterminate conditionals. For example, we might know that the
variable "x" has a value between 1 and 5, and we might know that "z"
is a string with the value "hello there world". We want to be able
to index z with Range(1,5) or slice it with say Range(1,5):Range (3,7). Our "z" value is represented by a string-like object that
presents much of the standard Python string API, so it knows what to
do with wacky slices with non-integer indices. We'd definitely want
to preserve the ability to do that.

-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Darwin)

iQCVAwUBRPOiDnEjvBPtnXfVAQJAWwQAnna3MD7qKDY0SFYyTmN/Dnoy3nBrsP/l kemAn8Rqdj/3EL/iJuesI8N81BtH6CUp3BR0XzCUpKnsTCcyZxjo9M9d96aF18Jm A8K/QKfRfRRNUe0FuSOwiizRjw8m1yP9k8GNqkOI5IO2B5qt6R8dvyvmAdigWIsg tVFftyC+1Dw= =HZRO -----END PGP SIGNATURE-----



More information about the Python-3000 mailing list