Hacker News new | ask | show | jobs
by jerryszczerry 3344 days ago
> Because Python 3.X is not backwards compatible and we have millions of lines of production code in Python 2.X.

I believe the common subset of Python 2 and 3 was created to ease that transition.

1 comments

That common subset doesn't include string handling.
You can absolutely do string handling in a common subset of Python 2 and Python 3. It won't work for legacy string handling code if you relied on implicit coercion, but then the same apps are unlikely to support unicode either.
> It won't work for legacy string handling code if you relied on implicit coercion

That's far from the only pitfall. For instance some of the P2 stdlib relies on implicit coercion to bytestrings whereas the Python 3 version has been properly converted to unicode (I discovered that when I tried to disable implicit coercion in one of the codebases I work with for cleanup/migration purposes).

So cross-platform string handling is not just a matter of properly splitting bytestrings and textstrings, but also finding out where "native strings" need to remain.