On Sat, May 29, 2010 at 4:26 PM, Gaurav Kalra <gvka...@gmail.com> wrote:
> Hi Noufal.
>
> >From Wikipedia:
> JSON only handle basic Python types like strings, integers, and
> collections of basic types, whereas pickle is intended for arbitrary
> objects.
>
> pickle won't be more suitable for what Murugadoss is asking for ?

For general purpose serialisation, json is better. Pickle is a Python
specific format that will necessitate that the remote end be Python
(or atleast have a sawn off depickler). Also, unpickling involves
something like execution and the data is to be treated as malicious
(check out the warning here -
http://docs.python.org/library/pickle.html).  JSON has no such issues
since it's just data . With JSON, the remote end is free to be in
whatever language you want which is a good thing.

It is possible to jsonify arbitrary types but you'll have to decide
how. I'm not sure there's much point in serialising code itself and
sending it across a line. Well, maybe for something like an RPC
mechanism but even then, it shouldn't be code but some data
representing an instruction of some kind.

-- 
~noufal
http://nibrahim.net.in
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to