Winter Madness - Passing Python objects as Strings

Hendrik van Rooyen mail at microcorp.co.za
Sat Jun 6 07:26:09 EDT 2009


"Miles Kaufmann" <mi at umich.edu> wrote:
> 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/

There is nothing new...

Normally it takes a long time before something is
re invented. 
In this case it looks like less than two years.

Thank you for the link

- Hendrik




More information about the Python-list mailing list