[Python-Dev] Reintroduce or drop completly hex, bz2, rot13, ... codecs (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Wed Jun 9 22:26:25 CEST 2010
- Previous message: [Python-Dev] Reintroduce or drop completly hex, bz2, rot13, ... codecs
- Next message: [Python-Dev] Reintroduce or drop completly hex, bz2, rot13, ... codecs
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, 09 Jun 2010 22:13:28 +0200 "Martin v. Löwis" <martin at v.loewis.de> wrote:
py> binascii.b2abase64(b'foo') b'Zm9v\n' py> binascii.b2ahex(b'foo') b'666f6f'
Now, I'd admit that "b2a" may be a misnomer (binary -> ASCII), but then it may not because ASCII actually also implies "bytes" (it's an encoding). So what would you propose to change: b2ahex should return a Unicode string? or this future transform method should return a Unicode string, whereas the module returns bytes? Something else?
Well, I would propose transform return str whereas b2a_hex returns bytes. But I agree the consistency argument with b2a_hex looks quite strong. (speaking of which, the builtin hex() functions returns str, although it's purpose is slightly different)
Regards
Antoine.
- Previous message: [Python-Dev] Reintroduce or drop completly hex, bz2, rot13, ... codecs
- Next message: [Python-Dev] Reintroduce or drop completly hex, bz2, rot13, ... codecs
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]