[Python-Dev] Why does base64 return bytes?
steve at pearwood.info
Wed Jun 15 08:34:01 EDT 2016
On Tue, Jun 14, 2016 at 09:40:51PM -0700, Guido van Rossum wrote:
> I'm officially on vacation, but I was surprised that people now assume
> RFCs, which specify internet protocols, would have a bearing on programming
> languages. (With perhaps an exception for RFCs that specifically specify
> how programming languages or their libraries should treat certain specific
> issues -- but I found no evidence that this RFC is doing that.)
Sorry to disturb your vacation!
I hoped that there might have been a nice simple answer, like "the
main use-case for Base64 is the email module, which needs bytes, and
thus it was decided". Or even "because backwards compatibility".
Thanks to everyone for their constructive comments, and expecially Mark
for digging up the original discussion on the Python-3000 list. I'm
satisfied that the choice made by Python is the right choice, and that
it meets the spirit (if, arguably, not the letter) of the RFC.
More information about the Python-Dev