[Python-3000] Making strings non-iterable
Simon Percivall
s.percivall at chello.se
Thu Apr 13 21:07:45 CEST 2006
On 13 apr 2006, at 20.01, Ian Bicking wrote:
> I propose that strings (unicode/text) shouldn't be iterable.
> Seeing this:
>
> <ul>
> <li> i
> <li> t
> <li> e
> <li> m
> <li>
> <li> 1
> </ul>
>
> a few too many times... it's annoying. Instead, I propose that
> strings
> get a list-like view on their characters. Oh synergy!
>
> Thus you would do:
>
> for c in a_string.chars():
> print c
The best scenario would be if strings were like they are now, except
that
to iterate you'd have to write iter(strobj). This would obviously
require
some changes to how iterability is determined, though.
//Simon
More information about the Python-3000
mailing list