[Python-ideas] `to_file()` method for strings

Michel Desmoulin desmoulinmichel at gmail.com
Mon Mar 28 11:44:15 EDT 2016


Le 28/03/2016 17:30, Chris Barker - NOAA Federal a écrit :
>> On Mar 24, 2016, at 7:22 PM, Nick Coghlan : what if we had a JSON-based save builtin that wrote
>> UTF-8 encoded files based on json.dump()?
> 
> I've been think about this for a while, but would rather have a
> "pyson" format -- I.e. Python literals, rather than JSON. This would
> preserve the tuple vs list and integer vs float distinction, and allow
> more options for dictionary keys.(and sets?).
> 
> Granted, you'd lose the interoperability, but for the quick saving and
> loading of data, it'd be pretty nice.
> 
> There is also JSON pickle:
> 
> https://jsonpickle.github.io
> 
> Though as I understand it, it has the same security issues as pickle.
> 
> But could we make a not-quite-as-complete pickle-like protocol that
> could save and load arbitrary objects, without ever running arbitrary
> code?

If it's for quick data saving, the security is not an issue since the
data will never comes from an attacker if you do a quick script.

For other needs, where security is an issue, having a oneliner to dump
some serialization is not going to do much of a difference.

> 
> -CHB
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
> 


More information about the Python-ideas mailing list