[Python-Dev] Bridging strings from Python to other languages

Guido van Rossum guido@python.org
Wed, 05 Feb 2003 10:52:19 -0500


Hi Bill,

I've read though the end of your post, and while I appreciate the
problem, I have little help to offer.  It's not even clear whether
you're asking for changes to Python or simply a hint as to how to
write your bridge.

To me, it seems that the crux is your requirement

>      (3) identity is maintained;   pass a string with id() 7570720 from 
> Python into the alien runtime and subsequently from the alien runtime 
> back into python and the same string instance with id() 7570720 really 
> should come back

In my experience almost no Python code depends on this property, and
it seems to be the most problematic one.  So why is this a
requirement?

If you can live with only using Unicode strings (even when all they
contain is ASCII or Latin-1 values), I think subclassing Unicode might
be the way to go.

I don't have time to dig deeper into this.  But if you think a small
change to Python can make life easier for you, I expect we'll be happy
to implement it, as long as it doesn't make life harder for Python
developers.

--Guido van Rossum (home page: http://www.python.org/~guido/)