Pickled objects over the network

Rustom Mody rustompmody at gmail.com
Fri Jul 20 03:42:11 EDT 2007


Thats just what I was saying:

If the IPC issues have been solved on your own terms but the
data-serialization -- what you call making strings -- are not so
satisfactory, you could use yaml (with safe_load) as a replacement for
pickle and continue to use networking and IPC as you are currently
doing.

As I understand it the drop-in replacement for pickle is syck or
pysyck which uses yaml internally. Ive not yet grokked what exactly is
the relation between yaml and syck.

Just to give a sense of the difference between yaml and pickle:

>>> from pickle import dumps
>>> from yaml import dump


>>> l=[1,2,{'color':'blue', 'height': 5}]
>>> print dump(l)
- 1
- 2
- {color: blue, height: 5}

>>> print dumps(l)
(lp0
I1
aI2
a(dp1
S'color'
p2
S'blue'
p3
sS'height'
p4
I5
sa.

On 7/20/07, Walker Lindley <brotherjenos at gmail.com> wrote:
> Right, I could use Pyro, but I don't need RPC, I just wanted an easy way to
> send objects across the network. I'm sure both Pyro and Yami can do that and
> I may end up using one of them. For the initial version pickle will work
> because we have the networking issues figured out with it, just not the
> security problem. So we may end up just sending strings back and forth that
> will let us fill out an object's member variables on the other end. It's
> much less cool, but it seems like it'd be more secure.
>
>
> -Walker
>
>
> On 7/19/07, Rustom Mody <rustompmody at gmail.com> wrote:
> >
> > Irmen de Jong wrote
> > > In what way would Pyro be overkill where Yaml (also a module that you
> need
> > > to install separately) wouldn't be?
> >
> > Sure they are the same to install and sure pyro can do the job (pyro
> > is a nice package).
> >
> > But I got the impression that the questioner wanted to do the
> > networking stuff himself at a low level (using sockets) and the data
> > management using some available library -- pickle.
> >
> > Since pickle has problems
> > -- does not interface well with networking
> > -- security issues
> > -- has an xml option that according to the docs is an order of magnitude
> slower
> >
> > I thought I would point out yaml (with safe-load) which sits somewhere
> > inbetween the xml-pickle and the default pickle.
> >
> > I should also mention here that I find yaml is much more known and
> > used in the ruby and perl world than in the python world.  This is
> > unfortunate considering that both ruby and perl have a traditional
> > syntax (begin end, { } etc ).  On the other hand, python and yaml have
> > similar modern syntactic structures -- structure follows indentation
> > -- and are therefore well matched to each other.
> >
> > So in summary the 'competition' is not between yaml and pyro -- pyro
> > could easily have a pickle-using-yaml option -- but between yaml and
> > xml.
> > --
> > http://mail.python.org/mailman/listinfo/python-list
> >
>
>
>
> --
> This e-mail is licensed under the Creative Commons Attribution-NoDerivs 2.5
> License. To view a copy of this license, visit
> http://creativecommons.org/licenses/by-nd/2.5/ or send a
> letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco,
> California, 94105, USA.
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list