3 ms·
I handled a transition of a multilingual/multiencoding Python 2 project to Python 3. Firstly, you can _still_ work entirely in bytes in Python 3 if you want to
by rtpg 9y ago
I handled a transition of a multilingual/multiencoding Python 2 project to Python 3.
Firstly, you can _still_ work entirely in bytes in Python 3 if you want to. But you can't call print on them... For good reason! You don't know the encoding to use to display them!
When we transitioned, there were a lot of subtle issues in our code due to our almost cargo cult usage of encoded/decode that ended with a lot of redundant transformations. Loads of that disappeared afterwards.
You can still operate in "Python 2 mode" in Python 3. The only exception I can think of is the difficulty in getting a bytestream version of standard output.
Also... Python 2 is decidably not like Go or Rust. The simplest example is how json.dumps would return bytes or a Unicode string depending on the keys on your object. No respect for typing
- dom0 9y ago> The only exception I can think of is the difficulty in getting a bytestream version of standard output. sys.{stderr, stdout, stdin}.buffer