[Python-ideas] Serializable method

Jim Rollenhagen jim at jimrollenhagen.com
Fri Mar 9 23:58:50 CET 2012


This idea was actually started because we were talking about how not all objects/types are JSON-serializable. The example at hand was the bytes type. 

// Jim


On Friday, March 9, 2012 at 2:56 PM, anatoly techtonik wrote:

> Improve documentation to point users to JSON module?
> http://docs.python.org/library/json.html
> 
> I didn't make any analysis if it is secure, but it seems a good starting point.
> The API seems a little hackish - perhaps there should be a recipe book.
> 
> There is also http://home.gna.org/oomadness/en/cerealizer/index.html linked
> from comments on this pickle insecurity research that can be handy
> http://nadiana.com/python-pickle-insecure
> --
> anatoly t.
> 
> 
> 
> On Sat, Mar 10, 2012 at 1:40 AM, Guido van Rossum <guido at python.org (mailto:guido at python.org)> wrote:
> > So what's your proposal)
> > 
> > --Guido van Rossum (sent from Android phone)
> > 
> > On Mar 9, 2012 2:38 PM, "anatoly techtonik" <techtonik at gmail.com (mailto:techtonik at gmail.com)> wrote:
> > > 
> > > Pickle is insecure, unfortunately, so a generic module to serialize
> > > and unserialize Python objects (or data containers) securely, without
> > > the need of constructor, would be awesome. However, magical methods
> > > are evil. It will be hard to find the source of error if the logic in
> > > your magic level fail.
> > > --
> > > anatoly t.
> > > 
> > > 
> > > 
> > > On Fri, Mar 9, 2012 at 8:27 PM, Jakob Bowyer <jkbbwr at gmail.com (mailto:jkbbwr at gmail.com)> wrote:
> > > > Another occasion I should have read the docs :L
> > > > 
> > > > 
> > > > On Fri, Mar 9, 2012 at 5:22 PM, Oleg Broytman <phd at phdru.name (mailto:phd at phdru.name)> wrote:
> > > > > 
> > > > > On Fri, Mar 09, 2012 at 05:05:51PM +0000, Jakob Bowyer wrote:
> > > > > > 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__
> > > > > > 
> > > > > 
> > > > > 
> > > > >   Do you mean __getstate__?
> > > > > http://docs.python.org/library/pickle.html#the-pickle-protocol
> > > > > 
> > > > > Oleg.
> > > > > --
> > > > >     Oleg Broytman            http://phdru.name/
> > > > >  phd at phdru.name (mailto:phd at phdru.name)
> > > > >           Programmers don't die, they just GOSUB without RETURN.
> > > > > _______________________________________________
> > > > > Python-ideas mailing list
> > > > > Python-ideas at python.org (mailto:Python-ideas at python.org)
> > > > > http://mail.python.org/mailman/listinfo/python-ideas
> > > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > _______________________________________________
> > > > Python-ideas mailing list
> > > > Python-ideas at python.org (mailto:Python-ideas at python.org)
> > > > http://mail.python.org/mailman/listinfo/python-ideas
> > > > 
> > > 
> > > _______________________________________________
> > > Python-ideas mailing list
> > > Python-ideas at python.org (mailto:Python-ideas at python.org)
> > > http://mail.python.org/mailman/listinfo/python-ideas
> > > 
> > 
> > 
> 
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org (mailto:Python-ideas at python.org)
> http://mail.python.org/mailman/listinfo/python-ideas
> 
> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120309/34478053/attachment.html>


More information about the Python-ideas mailing list