On 4/16/06, Aahz <[EMAIL PROTECTED]> wrote: > On Sun, Apr 16, 2006, Greg Ewing wrote: > > Jim Jewett wrote: > >> > >> (I wouldn't want to give up slicing, though, which might make the > >> no-iteration trickier.) > > > > You'd want to allow slicing but not indexing -- i.e. > > s[i:j] is okay but not s[i].
(I'm surprised by this. Why would s[i] be wrong?) > Ewww. I've been getting steadily less comfortable with this idea, > despite the fact that I've been bitten a few times by iterating over > strings. This, however, is enough to make me a firm thumbs-down on the > idea: I think it is gratuitous code breakage. I think it is perfectly > reasonable to want to look at a single character of a string. I think you may be right. I implemented this (it was really simple to do) but then found I had to fix tons of places that iterate over strings. For example: - The sre parser and compiler use things like set("0123456789") and also iterate over the characters of the input regexp to parse it. - difflib has an API defined for either two lists of strings (a typical line-by-line diff of a file), or two strings (a typical intra-line diff), or even two lists of anything (for a generalized sequence diff). - small changes in optparse.py, textwrap.py, string.py. And I'm not even at the point where the regrtest.py framework even works (due to the difflib problem). -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com