Hacker News new | ask | show | jobs
by progbits 1600 days ago
Semi-related (about length of emoji "characters", not reversing): https://hsivonen.fi/string-length/

Previously discussed:

https://news.ycombinator.com/item?id=20914184

https://news.ycombinator.com/item?id=26591373

As for this article & Python - as usual it is biasing towards convenience and implicit behavior rather than properly handling all edge cases.

Compare with Rust where you can't "reverse" a string - that is not a defined operation. But you can either break it into a sequence of characters or graphemes and then reverse that, with expected results: https://play.rust-lang.org/?version=stable&mode=debug&editio...

(Sadly the grapheme segmentation is not part of standard library, at least yet)

1 comments

> Sadly the grapheme segmentation is not part of standard library, at least yet

Seeing as grapheme segmentation is a moving target that only makes sense.