[Python-Dev] Why can't I encode/decode base64 without importing a module?
barry at python.org
Tue Apr 23 17:07:25 CEST 2013
On Apr 22, 2013, at 10:30 PM, Donald Stufft wrote:
>I may be dull, but it wasn't until I started using Python 3 that it really
>clicked in my head what encode/decode did exactly. In Python2 I just sort of
>sprinkled one or the other when there was errors until the pain stopped. I
>mostly attribute this to str.decode and bytes.encode not existing.
This is a key observation. It's also now much easier to *explain* what's
going on and recommend correct code in Python 3, so overall it's a win.
That's not to downplay the inconvenience of not being able to easily do
bytes->bytes or str->str transformations as easily as was possible in Python
2. I've not thought about it much, but placing those types of transformations
on a different set of functions (methods or builtins) seems like the right
direction. IOW, don't mess with encode/decode.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 836 bytes
Desc: not available
More information about the Python-Dev