stackless and pickling functions/lambdas
lars van Gemerden <[email protected]> Mon, 18 Aug 2014 12:05:42 +0200
| Newsgroups | gmane.comp.python.stackless |
|---|---|
| Message-ID | <CAP8kt8xa4bfxck6qKNM=VFUFOOJpsjAN09s_XnYXB0kO1GrLSQ@mail.gmail.com> |
--===============0899708768866288745==
Content-Type: multipart/alternative; boundary=14dae93d970a80f8f00500e48319
--14dae93d970a80f8f00500e48319
Content-Type: text/plain; charset=UTF-8
Hi,
I have a short question: does the ability for stackless to pickle tasklets
also mean that it can pickle functions and lambda's?
as in:
import cPickle as pickle
if __name__ == "__main__":
s = pickle.dumps(lambda x, y: x+y)
f = pickle.loads(s)
assert f(3,4) == 7
Cheers, Lars
--
====================================
Lars van Gemerden
[email protected]
+31 6 26 88 55 39
====================================
--14dae93d970a80f8f00500e48319
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Hi,<div><br></div><div>I have a short question: does the a=
bility for stackless to pickle tasklets also mean that it can pickle functi=
ons and lambda's?</div><div><br></div><div>as in:</div><div><br></div>
<div><div>import cPickle as pickle</div><div><br></div><div>if __name__ =3D=
=3D "__main__":</div><div>=C2=A0 =C2=A0 s =3D pickle.dumps(lambda=
x, y: x+y)</div><div>=C2=A0 =C2=A0 f =3D pickle.loads(s)</div><div>=C2=A0 =
=C2=A0 assert f(3,4) =3D=3D 7</div><div>
<br></div><div>Cheers, Lars</div>-- <br>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
<br>Lars van Gemerden<br><a href=3D"mailto:[email protected]">lars@ratio=
nal-it.com</a><br>+31 6 26 88 55 39<br>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
</div></div>
--14dae93d970a80f8f00500e48319--
--===============0899708768866288745==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless
--===============0899708768866288745==--