April 24, 2013
3:45 a.m.
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* encouraged.
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.