[Python-ideas] unicodedata.itergraphemes (or str.itergraphemes / str.graphemes)

Philipp A. flying-sheep at web.de
Wed Jul 10 19:39:48 CEST 2013


2013/7/10 Joshua Landau joshua at landau.ws

>>> {}.keys()
dict_keys([])
>>> iter({}.keys())
<dict_keyiterator object at 0x7fe3d633a890>

There are good reasons why a “view” should not be its iterator.

you’re right, but one would expect the view’s __getitem__(i) method to
return the ith grapheme, which implies constant-time access. and we can
only support linear-time access to that (i.e. by iterating stuff) if we
don’t want to build a complex index.

so should we do a view object that only allows something like my
find_grapheme and iteration?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130710/102d2b8c/attachment.html>


More information about the Python-ideas mailing list