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

M.-A. Lemburg mal at egenix.com
Sat Sep 8 09:08:55 EDT 2018

On 08.09.2018 13:33, 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.
> On checking my blog statistics today I found that it still had a
> readership and revisited the code
> <http://rosettacode.org/wiki/Reverse_a_string#Python:_Unicode_reversal>
> (and updated it to Python3.6)..
> I found that amongst the nearly 200 languages that complete the RC
> task,there were a smattering of languages that correctly handled
> reversing strings having Unicode combining characters,
> including Perl 6 <http://rosettacode.org/wiki/Reverse_a_string#Perl_6>
> which uses flip.
> I would like to propose that Python add a Unicode-aware *str.reverse
> *method. The problem is, I'm a Brit, who only speaks English and only
> very rarely dips into Unicode./I don't know how useful this would be!/

I've been using Unicode for quite a while and so far never had
a need to reverse a string in real life.

This sometimes comes up as coding challenge and perhaps in language
classes as exercise, but I can hardly imaging a use case where
we'd need a builtin method for this.

Marc-Andre Lemburg

Professional Python Services directly from the Experts (#1, Sep 08 2018)
>>> Python Projects, Coaching and Consulting ...  http://www.egenix.com/
>>> Python Database Interfaces ...           http://products.egenix.com/
>>> Plone/Zope Database Interfaces ...           http://zope.egenix.com/

::: We implement business ideas - efficiently in both time and costs :::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611

More information about the Python-ideas mailing list