4 ms·
Semi-related (about length of emoji "characters", not reversing): https://hsivonen.fi/string-length/ https://hsivonen.fi/string-length/ Previously discussed:
by progbits 5y ago
Semi-related (about length of emoji "characters", not reversing): https://hsivonen.fi/string-length/ https://hsivonen.fi/string-length/
Previously discussed:
https://news.ycombinator.com/item?id=20914184 https://news.ycombinator.com/item?id=20914184
https://news.ycombinator.com/item?id=26591373 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&edition=2021&gist=6335bb2c5cacf308ed5190deaba0121f https://play.rust-lang.org/?version=stable&mode=debug&editio...
(Sadly the grapheme segmentation is not part of standard library, at least yet)
- account42 5y ago> 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.