[Python-Dev] why doesn't print pass unicode strings on to the file object?

M.-A. Lemburg mal@lemburg.com
Tue, 18 Sep 2001 15:53:18 +0200


Fredrik Lundh wrote:
> 
> martin wrote:
> 
> > I guess not. If the codec.lookup return value is changed, then I can
> > write
> >
> > encoder = codecs.lookup("latin-1").encode
> >
> > Without that, I have to write
> >
> > encoder = codecs.CodecInfo(codecs.lookup("latin-1")).encode
> 
> or you could make things more readable, and add explicit
> get-functions for each property:
> 
>     encoder = codecs.getencoder("latin-1")
> 
> much easier to understand, especially for casual users
> (cf. os.path.getsize etc)

+1

Funny, the C API provides APIs for this already ;-)

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Consulting & Company:                           http://www.egenix.com/
Python Software:                        http://www.lemburg.com/python/