[Python-Dev] Why can't I encode/decode base64 without importing a module?

Stephen J. Turnbull stephen at xemacs.org
Wed Apr 24 04:45:43 CEST 2013

Terry Jan Reedy writes:

 >   .transform should be explicit and always take two args, no implicit 
 > defaults, the 'from form' and the 'to' form. They can labelled by 
 > position in the natural order (from, to)

Not natural to escaped-from-C programmers, though.  I hesitate to say
"make it keywords-only", but using keywords should be *strongly*

 > str.transform would always be unicode to unicode and bytes.transform 
 > always bytes to bytes.

Which leaves the salient cases (MIME content transfer encodings) out
in the cold, although I guess

    string.encode('ascii').transform(from='base64', to='bytes')

isn't too horrible.

More information about the Python-Dev mailing list