From: Donnal Walter <donnalcwalter@ya...> - 2002-08-21 00:48:59
As an alternative to:
mystring = Dump(myobject)
myobject = Load(mystring)
I have considered writing a set of simple Python mix-ins such that
Maps, Lists and Cells are able to store (serialize) and retrieve
(deserialize) themselves recursively:
Arkansas Children's Hospital
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
From: Steve Howell <showell@zi...> - 2002-08-21 01:25:14
From: "Donnal Walter" <donnalcwalter@...>
> As an alternative to:
> mystring = Dump(myobject)
> myobject = Load(mystring)
> I have considered writing a set of simple Python mix-ins such that
> Maps, Lists and Cells are able to store (serialize) and retrieve
> (deserialize) themselves recursively:
> Any thoughts?
Well, my first thought is that you'd probably love Ruby, which allows you to add
methods to the Hash, Array, and String classes.
I am not really sure what you're driving at, though. Can you give us more
The whole idea of PyYaml is that native Python thingies like directionaries,
lists, and strings can serialize and deserialize themselves recursively, without
having to inherit from any magical superclasses. But then YAML also serializes
classes. If you want a class to just serialize its dictionary, YAML will do
that for free, and then you can also have the object give a different view of
itself to YAML via to_yaml() and from_yaml(). And, of course, you don't have to
write to_yaml() and from_yaml() methods for every class that you want to
serialize with YAML; you could certainly use mixins for that.
Have you looked at the PyYaml approach for serializing objects, which I sent to
the list last Thursday?
I wonder if any ideas there are in line with your current thinking.
Apologies if I'm just missing the boat on your idea.