3 ms·
>Base64 encoding returns bytes. Why would anybody _ever_ want that? What corner case do you think python 3 is solving with the return type being a byte array?
by macspoofing 10y ago
>Base64 encoding returns bytes. Why would anybody _ever_ want that?
What corner case do you think python 3 is solving with the return type being a byte array? Surely you must have looked into it because clearly it isn't arbitrary ... Right?
>The whole purpose of B64 encoding is to make something string-safe
Guess again.
- Mizza 10y agoFrom Wikipedia: "Base64 is a group of similar binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation." Binary. To. Text. As in - bytes in, text out. Come on now.
- SmirkingRevenge 10y agoIts intentional, in part because of all the mayhem caused by Python2's "free-spirited" view on whether a thing is bytes or text. And that "free-spirited" view caused A LOT of mayhem. Python3 errs on the side of not converting bytes to strings or vice versa unless its an explicit conversion on the bytes/string object itself. And it is fan-fucking-tastic!