[Python-ideas] Add Unicode-aware str.reverse() function?
Steven D'Aprano
steve at pearwood.info
Sun Sep 9 01:29:07 EDT 2018
More information about the Python-ideas mailing list
Sun Sep 9 01:29:07 EDT 2018
- Previous message (by thread): [Python-ideas] Add Unicode-aware str.reverse() function?
- Next message (by thread): [Python-ideas] Add Unicode-aware str.reverse() function?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, Sep 08, 2018 at 04:33:07AM -0700, Paddy3118 wrote: > I wrote a blog post > <http://paddy3118.blogspot.com/2009/07/case-of-disappearing-over-bar.html>nearly > a decade ago on extending a Rosetta Code task example > <http://rosettacode.org/wiki/Reverse_a_string>to handle the correct > reversal of strings with combining characters. I wouldn't care too much about a dedicated "reverse" method that handled combining characters. I think that's just a special case of iterating over graphemes. If we can iterate over graphemes, then reversing because trivial: ''.join(reversed(mystring.graphemes())) The Unicode Consortium offer an algorithm for identifying grapheme clusters in text strings, and there's at least three requests on the tracker (one closed, two open). https://bugs.python.org/issue30717 https://bugs.python.org/issue18406 https://bugs.python.org/issue12733 -- Steve
- Previous message (by thread): [Python-ideas] Add Unicode-aware str.reverse() function?
- Next message (by thread): [Python-ideas] Add Unicode-aware str.reverse() function?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list