[Python-Dev] Docs for string methods ?

Fredrik Lundh fredrik@pythonware.com
Wed, 5 Jul 2000 12:20:04 +0200


mal wrote:
> Fredrik Lundh wrote:
> > 
> > mal wrote:
> > > I've just checked in new string methods
> > 
> > talking about string methods: how about providing an
> > "encode" method for 8-bit strings too?
> 
> I've tossed that idea around a few times too... it could
> have the same interface as the Unicode one (without default
> encoding though). The only problem is that there are currently
> no codecs which could deal with strings on input.

imho, a consistent interface is more important than a truly
optimal implementation (string are strings yada yada).  or in
other words,

    def encode(self, encoding):
        if encoding is close enough:
            return self
        return unicode(self).encode(encoding)

ought to be good enough for now.

</F>