[Python-Dev] Optional arguments for str.encode /.decode

Barry Warsaw barry at python.org
Fri Nov 7 09:22:32 EST 2003


On Fri, 2003-11-07 at 02:33, Raymond Hettinger wrote:
> Idea for the day:  Let the str.encode/decode methods accept keyword
> arguments to be forwarded to the underlying codec.

Nice.

> Already, the existing protocol has provided consistent, uniform access
> to a variety of services:
> 
>     text.encode('quotedprintable')
>     text.encode('rot13')
>     text.encode('palmos')
> 
> The proposed extension allows this benefit to apply to an even broader
> range of services.

Which is all really cool.  The only thing that begins to bother me about
this is the use of strings as name lookup keys for finding functions. 
This seems generally unpythonic and error prone -- aside from the
documentation problem that the list of standard lookup keys is buried in
a non-obvious place.

-Barry





More information about the Python-Dev mailing list