On Wed, Jul 29, 2020 at 9:02 PM TB <math...@gmail.com
> One disadvantage of pickle is safety, in the computer security sense. See the warning at  about it, that it is possible to execute arbitrary code during unpickling. This of course also happens to be useful in Sage .
> If it happens that your data can be (easily) represented as iterated Python containers (tuples, lists, dicts or sets) containing strings, integers or booleans, then a textual format can be a good fit. JSON, YAML or even ast.literal_eval  sound appropriate. More complex objects are indeed more complex to handle. At least for polynomials the parser at  might help.
> JSON or YAML are interoperable, which is important if you would like to use the data in another system. It does mean that doing something clever with the data might still require porting code from Sage that handles the data.
I have suggested many times because of this that Sage needs a standard
interfacing for converting Sage Objects to JSON-compatible data
structures (which would have to be defined, preferably along with a
schema, for any and all types that want to support this). Possibly
with some optional support for BSON for more efficient binary
representation of large objects.
I would be happy to help with such an effort from the technical side,
but I'm not the best person to lead it since it cuts to the core of
the subject of mathematical data interchange, a subject on which there
are experts, and I am not one of them.
But I really do wish we would de-emphasize the use of pickle for
saving Sage objects. It's perfectly good for caching certain
computations and storing large computational results to disk for
near-future use, as well as for distribution over clusters and the
like. But we need to make it very clear to users that this is *not*
an archival data format, while at the same time offering something
better that is.