3 ms·
> namely the UTF-8 system What are you talking about here? Is it the FSR introduced in 3.3, or the split between unicode and byte strings? Because if the latte
by masklinn 13y ago
> namely the UTF-8 system
What are you talking about here? Is it the FSR introduced in 3.3, or the split between unicode and byte strings? Because if the latter
> and the whole community switched over in about a year.
must have been written under influence, the unicode/bytes semantics split and inability to play fast and loose with the definition of "string" in P3 is by far the biggest difficulty when switching between P2 and P3[0].
And that split and the backwards incompatibility it generated is pretty much the reason why the core team felt adding further non-BC features was OK: there was no way usual non-trivial P2 code would work on P3 in the first place (especially since this was in the 2.6 release cycle, most of the backports were added later in 2.7), so they may as well clean up the language and stdlib while at it.
[0] and the reason why most libraries didn't work OOTB, and why some protocol — WSGI for instance — had to be rethought in-depth to try and understand what is and is not a string.
- ygra 13y ago> inability to play fast and lose with the definition of "string" If that wasn't intentional it's a very fitting typo. In either case it describes perfectly why Python 3's distinction between text and data (or Unicode and byte strings) is much better than the Python 2 state of affairs which tends to work somewhat until it breaks (similar to string handling in C/C++ when Unicode is encountered).
- masklinn 13y ago> If that wasn't intentional it's a very fitting typo. It wasn't[0], and though I agree I fixed it. > In either case it describes perfectly why Python 3's distinction between text and data (or Unicode and byte strings) is much better than the Python 2 state of affairs Yes, although it really annoys people who work at the boundary or in domains where the distinction is unclear or ill-defined (urls, HTTP headers, environment variables, …). Which is probably why e.g. Armin Ronacher has so many issues with it[1]: the vast majority of his stuff (at least for the libraries he releases) operate across these boundaries. [0] I actually spent a second wondering, and then I got it wrong anyway. [1] http://lucumr.pocoo.org/2014/1/5/unicode-in-2-and-3/ http://lucumr.pocoo.org/2014/1/5/unicode-in-2-and-3/
- penguindev 13y agoAnd it still scares me that python 3 has hackery to fake unicode dirlistings on unix. (surrogate escaping - pep-0383). I guarantee that will bite people in the ass and cause security bugs. 'explicit is better than implicit' - hah.