object serialization as python scripts

Chris Rebert clp2 at rebertia.com
Fri Nov 13 19:45:24 CET 2009

On Fri, Nov 13, 2009 at 10:26 AM, King <animator333 at gmail.com> wrote:
>> Why is it easier than the above mentioned - they are *there* (except the
>> custom xml), and just can be used. What don't they do you want to do?
>> Other than that, and even security issues put aside, I don't see much
>> difference between pickle and python code, except the latter being more
>> verbose. Which suits humans, but other than that has no advantage.
>> Diez
> My application is PyQt based and objects that I am trying to save are
> couple of QGraphicsItem instances. You can't save instances of
> QGraphicsItem
> using pickle or shelve.
> Custom xml format would be a real pain as you have to write code for
> writing/reading both.
> I am aware of security issue but over all there are only 5 statements
> I have to use to get the entire
> information back. I can do syntax checking and other stuff before I
> should execute the script.
> Another reason is that data should be in human readable form.

Did you consider the `json` module? JSON is almost identical to Python
literal syntax.


More information about the Python-list mailing list