Nick Coghlan added the comment:

Since this particular tutorial section was written long before the json module 
was part of the standard library, I think it makes sense to switch now we have 
the option.

pickle is definitely a useful tool, but now that JSON is available by default, 
it's now one to escalate to if JSON doesn't meet your needs, rather than the 
one to use by default.

Chris's patch looks generally good to me, although I think it could use a 
second paragraph in the pickle section. Perhaps something like:

"""JSON is much simpler to use safely than pickle, and offers broader 
interoperability with programs written in other languages. However, pickle has 
the advantage of supporting a much wider range of Python object types, 
including executable code, which means it can handle use cases that JSON can't 
(like sending code to another process for execution)"


This simpler/safer/less powerful API/technique vs more powerful/more dangerous 
API/technique trade-off is a fairly common one, so I think it's a good thing to 
have a concrete example of it in the tutorial rather than just dropping the 
reference to pickle entirely.

----------
nosy: +ncoghlan

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18840>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to