[Python-3000] Making more effective use of slice objects in Py3k
barry at python.org
Tue Aug 29 04:10:14 CEST 2006
-----BEGIN PGP SIGNED MESSAGE-----
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)
-----END PGP SIGNATURE-----
More information about the Python-3000