[Python-ideas] Serializable method
jkbbwr at gmail.com
Fri Mar 9 18:05:51 CET 2012
So originally I presented this idea for serialize methods something like
but the idea was rightly shot down where the language would have to support
most formats and this could lead to confusion or complication.
So this is a newer version of that idea.
I think that object should provide an __serializable__ method which in-turn
allows the user to define in it how the object is to be serialized, the
default operation should be something along the lines of return
self.__dict__ but that is just semantics. The idea with an object that
offers a serializable method means that the object can be passed directly
to any formater in python that offers a .dump method and the object
is immediately formatted how the end user wants the data to be, without
needing to write a middle layer formatter for this object.
Is this another terrible idea from me? Or is there some ground in this?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas