Hi,
I have a few questions about how PySyck handles objects/instances. I
subclassed Dumper and overwrote represent_dict() to ignore keys
prefixed with '_v_', the aim being to temporarily store unserializable
things like locks, threads, sockets, etc in large nested structures
that I want to serialize.
This works pretty well. However, represent_dict is never called for an
object's __dict__. Why is that? Also, what method does handle
__dict__? Both represent_instance() or represent_object() look like
they could handle it.
Would it be possible to replace calls to _syck.Map() with
represent_dict()? It looks like the main modification would be to add
an extra "postfix" argument to represent_dict, which would be appended
to the tag argument of _syck.Map in order to differentiate between
"object:"+class_name, "new:"+class_name, and "map". This should allow
represent_dict to truly handle all calls to _syck.Map, which would
make life easier for those (like me) who want to customize this aspect
of the Dumper.
Btw, why are there two definitions of represent_object()? The later
definition has a somewhat disquieting comment. Is it deprecated in
favor of represent_instance?
Sincerely,
Chris Spencer
|