[Python-Dev] Why can't I encode/decode base64 without importing a module? (original) (raw)
Xavier Morel catch-all at masklinn.net
Thu Apr 25 12:46:43 CEST 2013
- Previous message: [Python-Dev] Why can't I encode/decode base64 without importing a module?
- Next message: [Python-Dev] Why can't I encode/decode base64 without importing a module?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2013-04-25, at 11:25 , Antoine Pitrou wrote:
Besides, I would consider a RFC more authoritative than a Wikipedia definition.
Base encoding of data is used in many situations to store or transfer data in environments that, perhaps for legacy reasons, are restricted to US-ASCII [1] data.
so the output is US-ASCII data, a byte stream.
Stephen is correct that you could decide you don't care about those semantics, and implement base64 encoding as a bytes -> str decoding then requiring a re-encoding (to ascii) before wire transmission.
The clarity of the interface (or lack thereof) would probably make users
want to send a strongly worded letter to whoever implemented it though,
I don't think data.decode('base64').encode('ascii')
would fit the
"obviousness" or "readability" expectations of most users.
- Previous message: [Python-Dev] Why can't I encode/decode base64 without importing a module?
- Next message: [Python-Dev] Why can't I encode/decode base64 without importing a module?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]