Re: [Python-Dev] Why does base64 return bytes?

2016年6月15日 14:03:07 -0700

Paul Moore:
> Finding out whether users/projects typically write such a helper
> function for themselves would be a better way of getting this
> information. Personally, I suspect they don't, but facts beat
> speculation.
Well, I did. It was necessary to get 2to3 conversion to work(*). I turned every occurence of
 E.encode('base-64')
and
 E.decode('base-64')
into helper function calls that for Python 3 did:
 b64encode(E).decode('ascii')
and
 b64decode(E.encode('ascii'))
(Or something similar, I don't have the code in front of me.)
Leaving out .decode/.encode('ascii') would simply not have worked. That would just be asking for TypeError's.
regards, Anders
(*) Yes, I use 2to3, believe it or not. Maintaining Python 2 code and doing an automated conversion to Python 3 as needed.
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to