[Python-3000] string C API

Jim Jewett jimjjewett at gmail.com
Wed Sep 13 19:27:28 CEST 2006


On 9/13/06, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> Jim Jewett schrieb:
> > Simply not encoding/decoding until required would save quite a bit of
> > time and space -- but then the object would need some way of
> > indicating which encoding it is in.

> Try implementing that some time. You'll find it will be incredibly
> complex and unmaintainable. Start with implementing len(s).

Simply delegate such methods to a hidden per-encoding subclass.

The UTF-8 methods will indeed be complex, unless the solution is
simply "someone called indexing/slicing/len, so I have to recode after
all."

The Latin-1 encoding will have no such problem.

-jJ


More information about the Python-3000 mailing list