[Python-3000] Making strings non-iterable

Aahz aahz at pythoncraft.com
Sun Apr 16 07:22:59 CEST 2006

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].

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.
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/


More information about the Python-3000 mailing list