Possible to write a Unicode*like* object?

Alex Martelli aleax at aleax.it
Tue Feb 4 12:59:32 EST 2003


Just wrote:
   ...
> I'm not sure sure myself, either... I think an example could be: can I
> write a class (in C) that will be treated just like a unicode object, eg
> when doing pattern matching with re?

You can inherit from unicode, of course -- whether that would
be sufficient for your purpose, I don't know, as it's quite
possible that modules such as re would bypass your overrides.

> I tend to think we shouldn't even try this and we should simply build a
> true unicode object, but there are voices in the project that say we
> should avoid the conversion at all cost. I wouldn't be too unhappy about

Hmmm, have those other voices read Knuth's ideas about premature
optimization...?  If actual measurements say things are too slow,
that's another issue, of course.


Alex





More information about the Python-list mailing list