[Python-ideas] Add Unicode-aware str.reverse() function?
Paddy3118
paddy3118 at gmail.com
Sat Sep 8 12:41:33 EDT 2018
Thanks for your replies.
After reading them,, although I seem to have a brain freeze at the moment
and
cannot think of an algorithm; I think it plausible, just in the ASCII world
for
someone to want to iterate through characters in a string in reverse order
-
maybe to zip with another existing iterable that would otherwise need to be
reversed? If it shifted from ASCII to unicode then letters with their
combining
characters would have to be reversed as a single character; but also
iterated
over as a single unicode "character" - another problem!
I thought so, I scratch the surface of unicode, and find a deep chasm
awaits.
On Saturday, 8 September 2018 12:33:07 UTC+1, 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!*
>
> Cheers, Paddy.
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180908/6552dfd6/attachment.html>
More information about the Python-ideas
mailing list