[Python-Dev] Internal representation of strings and Micropython

Serhiy Storchaka storchaka at gmail.com
Thu Jun 5 09:39:18 CEST 2014


05.06.14 03:03, Greg Ewing написав(ла):
> Serhiy Storchaka wrote:
>> html.HTMLParser, json.JSONDecoder, re.compile, tokenize.tokenize don't
>> use iterators. They use indices, str.find and/or regular expressions.
>> Common use case is quickly find substring starting from current
>> position using str.find or re.search, process found token, advance
>> position and repeat.
>
> For that kind of thing, you don't need an actual character
> index, just some way of referring to a place in a string.

Of course. But _existing_ Python interfaces all work with indices. And 
it is too late to change this, this train was gone 20 years ago.

There is no need in yet one way to do string operations. One obvious way 
is enough.




More information about the Python-Dev mailing list