Possible to write a Unicode*like* object?

Just just at xs4all.nl
Tue Feb 4 11:53:22 EST 2003


In article <7h3znpctbm4.fsf at pc150.maths.bris.ac.uk>,
 Michael Hudson <mwh at python.net> wrote:

> Just <just at xs4all.nl> writes:
> 
> > In the PyObjC project (a bridge between Python and Objective-C, and/or 
> > Cocoa really, OSX's GUI stuff) there's currently a discussion about 
> > whether to _convert_ NSString instances (the Cocoa string class) to 
> > Python (unicode) strings or to wrap the original instance that would 
> > make it string-like. For 8-bit strings wrapping is probably not a big 
> > deal, the buffer interface makes this work quite transparently, but I 
> > have no clue whether this is possible for unicode strings as well. Any 
> > ideas?
> 
> I think you can return unicode data through the buffer interface too,
> can't you?  In any case, I'm a bit unsure what exactly you're asking.

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?

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 
that, provided it can work reasonably transparently, which I doubt.

Just




More information about the Python-list mailing list