[Python-ideas] Add Unicode-aware str.reverse() function?

Jonathan Fine jfine2358 at gmail.com
Sat Sep 8 09:53:05 EDT 2018


Terry Ready wrote:

> A python string is a sequence of unicode codepoints.  String methods operate
> on the string as such.  We intentionally leave higher level methods to third
> parties.  One reason is the problem of getting such things 'right' for all
> strings.  What do we do with a leading combining char?  Do combining
> characters always combine with the preceding char, as your code assumes?  Do
> all languages treat all combining characters the same?  (Pretty sure not.)
> Does .combining() encompass all order dependencies that should considered in
> a higher level reverse function? (According the the page you reference, no.)

I've already mentioned Yannis Haralambous (in this thread). He's
something of an expert on these matters. And also the author of

Fonts & Encodings: From Advanced Typography to Unicode and Everything in Between
http://shop.oreilly.com/product/9780596102425.do

He's likely to know how to get things right for users for all (or at
least many) languages and strings. I've let him know about this
discussion.

-- 
Jonathan


More information about the Python-ideas mailing list