[Python-3000] String comparison

Bill Janssen janssen at parc.com
Thu Jun 7 18:35:55 CEST 2007


> Then you wouldn't even be able to iterate over or index strings anymore,
> as that could produce such "invalid" strings, which would need to
> generate exceptions if you really want to ban them.

I don't think that's right: iterating over the the string should
presumably generate a iteration of valid sub-strings, each of length
one.  It would not generate a sequence of integers.

  [x for x in "abc"] != [ord(x) for x in "abc"]

> making people type 'o\u0308'[1] instead of '\u0308'?

'o\u0308'[1] should generate an ArrayBounds exception, since you're
indexing into a string of length 1.

Bill


More information about the Python-3000 mailing list