On 25/11/10 06:37, Alexander Belopolsky wrote:
I don't think there is a recipe on how to fix legacy
character-by-character processing loop such as
for c in string:
...
to make it iterate over code points consistently in wide and narrow
builds.
A couple of possibilities:
1) Make things so that 'for c in string' does actually
iterate over characters rather than code units. This could
break existing code, though.
2) Provide some things like
for c in string.chars():
...
for c in string.graphemes():
...
where chars() and graphemes() return appropriate iterators.
(Or possibly iterable views, but that would raise the
expectation that the views could also be randomly indexed
by char or grapheme, which we probably wouldn't want to
support.)
--
Greg
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com