Re: Serializing functions

2010-06-17 Thread Chris Rebert
2010/6/17 Andreas Löscher : > Am Donnerstag, den 17.06.2010, 18:03 +0200 schrieb Andreas Löscher: >> Am Donnerstag, den 17.06.2010, 08:18 -0700 schrieb Paul Rubin: >> > Matteo Landi writes: >> > > I could be wrong, but it seems functions are not marshable objects, is >> > > it right? >> > >> > Hmm

Re: Serializing functions

2010-06-17 Thread Aaron Staley
I am one of the developer's of PiCloud. To answer your question, we wrote a custom subclass of Pickler to pickle functions. As Robert pointed out, the library is LGPL, so you can see (and use) the source code. I also presented the details on a poster at PyCon 2010. You can see it here: http://b

Re: Serializing functions

2010-06-17 Thread Robert Kern
On 6/17/10 8:23 AM, Matteo Landi wrote: Some weeks ago, here on the mailing list I read about picloud[1], a python library used for cloud-computing; I was impressed by its simplicity, here is an example: import cloud def square(x): ... return x * x cloud.call(square, 10) cloud.result() 100

Re: Serializing functions

2010-06-17 Thread Andreas Löscher
Am Donnerstag, den 17.06.2010, 18:03 +0200 schrieb Andreas Löscher: > Am Donnerstag, den 17.06.2010, 08:18 -0700 schrieb Paul Rubin: > > Matteo Landi writes: > > > I could be wrong, but it seems functions are not marshable objects, is > > > it right? > > > > Hmm, you're right, you can marshal cod

Re: Serializing functions

2010-06-17 Thread Andreas Löscher
Am Donnerstag, den 17.06.2010, 08:18 -0700 schrieb Paul Rubin: > Matteo Landi writes: > > I could be wrong, but it seems functions are not marshable objects, is > > it right? > > Hmm, you're right, you can marshal code objects, but you can't marshal a > function directly. It's been a while since

Re: Serializing functions

2010-06-17 Thread Matteo Landi
On Thu, 2010-06-17 at 08:31 -0700, Stephen Hansen wrote: > On 6/17/10 6:23 AM, Matteo Landi wrote: > > itself. If you try and pickle a function, it is not pickled as a whole, > > indeed, once you unpickle it, it will raise an exception telling you > > that the target function was not found in the c

Re: Serializing functions

2010-06-17 Thread Stephen Hansen
On 6/17/10 6:23 AM, Matteo Landi wrote: > itself. If you try and pickle a function, it is not pickled as a whole, > indeed, once you unpickle it, it will raise an exception telling you > that the target function was not found in the current module. You can pickle functions-- and classes, instances

Re: Serializing functions

2010-06-17 Thread Matteo Landi
On Thu, 2010-06-17 at 07:37 -0700, Paul Rubin wrote: > Matteo Landi writes: > > If you try and pickle a function, it is not pickled as a whole, > > indeed, once you unpickle it, it will raise an exception telling you > > that the target function was not found in the current module. > > > > So I'm

Re: Serializing functions

2010-06-17 Thread Paul Rubin
Matteo Landi writes: > I could be wrong, but it seems functions are not marshable objects, is > it right? Hmm, you're right, you can marshal code objects, but you can't marshal a function directly. It's been a while since I've used marshal and I forgot how it works. You might be able to concoct

Re: Serializing functions

2010-06-17 Thread Matteo Landi
On Thu, 2010-06-17 at 07:37 -0700, Paul Rubin wrote: > Matteo Landi writes: > > If you try and pickle a function, it is not pickled as a whole, > > indeed, once you unpickle it, it will raise an exception telling you > > that the target function was not found in the current module. > > > > So I'm

Re: Serializing functions

2010-06-17 Thread Paul Rubin
Matteo Landi writes: > If you try and pickle a function, it is not pickled as a whole, > indeed, once you unpickle it, it will raise an exception telling you > that the target function was not found in the current module. > > So I'm here, with nothing in my hands; how would you implement this? Us

Re: Serializing functions

2010-06-17 Thread Bruno Desthuilliers
Matteo Landi a écrit : Some weeks ago, here on the mailing list I read about picloud[1], a python library used for cloud-computing; I was impressed by its simplicity, here is an example: import cloud def square(x): ... return x * x cloud.call(square, 10) cloud.result() 100 So, I tried to f

Serializing functions

2010-06-17 Thread Matteo Landi
Some weeks ago, here on the mailing list I read about picloud[1], a python library used for cloud-computing; I was impressed by its simplicity, here is an example: >>>import cloud >>>def square(x): ... return x * x >>>cloud.call(square, 10) >>>cloud.result() 100 So, I tried to figure out how to