[Python-3000] PEP 3108: Standard Library Reorganization

Barry Warsaw barry at python.org
Wed Jan 3 15:42:54 CET 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Jan 3, 2007, at 9:23 AM, Michael Urman wrote:

> On 1/2/07, Anthony Baxter <anthony at interlink.com.au> wrote:
>> base64.encodestring('hello world')
>> or
>> base64.b64encode('hello world')
>>
>> become
>> codecs.getencoder('base64')('hello')[0]
>
> Isn't this a lot more idiomatically translated as
>     'hello world'.encode('base64')
> or is there still too much worry that this will require
> encoding/decoding ascii bytestrings?
>
> Your additional points about base32 and base16 still apply to
> .encode(), as they each result in an unknown encoding LookupError.

And don't forget that options can be passed to the encoders.

But fundamentally, I really dislike having to specify the encoder as  
a string rather than as a POFC (plain ol' function call).

- -Barry

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iQCVAwUBRZvA7nEjvBPtnXfVAQLYegP/ad1cGpFPqWwvTypuVwhzDKkQ0Zvi8SL1
VwuPDASO+m5gtofYp7GXWHrjMv7AUjq6lrZIp/LFSiwlS56yXZHhcJM3OJFVCq6p
FAoz0nuW7KN4C3AAC2SjEcTb/pG2czZndtlivA7IKSL5L8OZQg0sFgPMKDI8IioL
h6lcgBmYVX0=
=DnSG
-----END PGP SIGNATURE-----


More information about the Python-3000 mailing list