[Python-ideas] string codes & substring equality

spir denis.spir at gmail.com
Fri Nov 29 07:21:00 CET 2013


On 11/29/2013 12:36 AM, Terry Reedy wrote:
>> certainly numerous other use cases exist.
>
> More that a hand wave is needed to demonstrate that.

You are right.

After some reflexion, I guess those use cases are:
* every time people compare single-char substrings
* every time people make a single-char slice nad use ord() on it
* every time people could simply do something using a unicode code at arbitrary 
position,
   but do otherwise because the correcponding method does not exist

We may not realise the breadth of potential usage until the right tool exist and 
starts to be used broadly. I think it is also somewhat comparable to building a 
string by piecemeal concat: people may just do it that way, and it works fine, 
doesn't it? However, once aware of the cost and that there is an _existing_ 
alternative, ...

Also, why does ord() exist? What's the point of such a builtin func working for 
single-code (historically: single-byte) strings only?

Denis


More information about the Python-ideas mailing list