Winter Madness - Passing Python objects as Strings
Miles Kaufmann
milesck at umich.edu
Sat Jun 6 04:23:44 EDT 2009
On Jun 4, 2009, at 3:25 AM, Hendrik van Rooyen wrote:
> A can is like a pickle, in that it is a string, but anything
> can be canned.
> Unlike a pickle, a can cannot leave the process, though,
> unless the object it points to lives in shared memory.
>
> If you have any interest, contact me and I will
> send you the source.
Sounds like di(), which can be written:
import _ctypes
di = _ctypes.PyObj_FromPtr
def can(o): return str(id(o))
def uncan(s): return di(int(s))
http://www.friday.com/bbum/2007/08/24/python-di/
-Miles
More information about the Python-list
mailing list