Winter Madness - Passing Python objects as Strings
Terry Reedy
tjreedy at udel.edu
Thu Jun 4 13:48:17 EDT 2009
Hendrik van Rooyen wrote:
> I can see that my explanation passes you by completely.
>
> I said, in my original post, that a can could not leave a process.
> A can is exactly the same as a C pointer, only its value has been
> converted to a string, so that you can pass it "in band" as
> part of a string. That is all it does. No more, no less.
If I understand correctly, your problem and solution was this:
You have multiple threads within a long running process. One thread
repeatedly reads a socket. You wanted to be able to occasionally send
an object to that thread. Rather than rewrite the thread to also poll a
queue.Queue(), which for CPython sends objects by sending a pointer, you
converted pointers to strings and sent (multiplex) them via the text
stream the thread was already reading -- and modified the thread to
decode and act on the new type of message.
And you are willing to share the can code with someone who has a similar
rare need and understands the danger of interpreting ints as addresses.
Correct?
tjr
More information about the Python-list
mailing list