|
|
Subscribe / Log in / New account

Linux distributions and Python 2

Linux distributions and Python 2

Posted Mar 5, 2021 11:22 UTC (Fri) by LtWorf (subscriber, #124958)
In reply to: Linux distributions and Python 2 by togga
Parent article: Linux distributions and Python 2

One could go and read a 10 minutes tutorial…


to post comments

Linux distributions and Python 2

Posted Mar 5, 2021 12:02 UTC (Fri) by pizza (subscriber, #46) [Link] (2 responses)

"go read a tutorial" does not change the data your python3 code encounters out in the real world.

Linux distributions and Python 2

Posted Mar 5, 2021 15:59 UTC (Fri) by LtWorf (subscriber, #124958) [Link] (1 responses)

It helps in knowing how to not write buggy code that handles encodings.

Anyway for "random data in the world" python3 is way better than python2. Which is why the change was made.

In python2 you couldn't really rely on ranges or indexes on strings, because you never knew if you would be splitting a unicode sequence and creating something broken.

But, it worked most of the times… it would just fail when unexpected unicode sequences appeared.

Linux distributions and Python 2

Posted Mar 5, 2021 16:15 UTC (Fri) by foom (subscriber, #14868) [Link]

In python3 you can't really rely on ranges or indexes on strings either, because you never know if you will be splitting a unicode grapheme cluster and creating something broken.

But, it works most of the time… it will just fail when unexpected unicode sequences appear (combining accents, or emoji skin tone modifiers, or flags, or ...)

Contrast this with perl6, which has built in support for correctly preserving grapheme clusters in it's string methods.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds