[Pyobjc-dev] Re: [Python-Dev] Bridging strings from Python to other languages (original) (raw)
Bill Bumgarner bbum@codefab.com
Wed, 5 Feb 2003 15:27:53 -0500
- Previous message: [Python-Dev] Bridging strings from Python to other languages
- Next message: [Pyobjc-dev] Re: [Python-Dev] Bridging strings from Python to other languages
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wednesday, Feb 5, 2003, at 10:52 US/Eastern, Guido van Rossum wrote:
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?
Because we are using Python to glue together other object oriented frameworks-- Apple's and third party's-- for which we do not have control over said behavior.
Sometimes an object is just an object and those frameworks insist on the same object-- same identifier/address-- coming out that went in.
As Just pointed out, my original example wasn't as clear as it could have been. If a String object comes out of the alien-to-python world and is later sent from python back into the alien-to-python runtime, the same String object-- the same id()-- must be sent back.
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.
Right. I believe that is the path will we go down.
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.
I can think of a couple of changes to Python that would be potentially quite helpful in this situation.
Specifically:
- ability to have weak references to string objects [and unicode
objects]. Since we can make arbitrary object associations and re-associations when crossing the bridge between environments, I believe weakref would allow us to maintain a reference map as long as we could grab the 'string is now going away' callback to update the weakref map when the string is deallocated
- ability to subclass string objects or the ability to add a hunk
of data-- the reference to the 'alien' string object-- to any string object.
Either one would work equally as well... whether or not they are easy to do, I have not a clue.
b.bum
- Previous message: [Python-Dev] Bridging strings from Python to other languages
- Next message: [Pyobjc-dev] Re: [Python-Dev] Bridging strings from Python to other languages
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]