On Wednesday 10 June 2015 13:57, random...@fastmail.us wrote: > On Tue, Jun 9, 2015, at 23:52, Steven D'Aprano wrote: >> > For human readable serialized data, text format protocol buffers are >> > seriously underrated. (Relatedly: underdocumented, too.) >> >> Ironically, literal_eval is designed to process text-format protocols >> using >> human-readable Python syntax for common data types like int, str, and >> dict. > > "protocol buffers" is the name of a specific tool.
It is? It sounds like a generic term for, you know, a buffer used by a protocol. I live and learn. https://developers.google.com/protocol-buffers/docs/pythontutorial You have to: - write a data template, in a separate file; just don't call it a schema, because this isn't XML; - don't forget the technically-optional-but-recommended (and required if you use other languages) "package" header, which is completely redundant in Python; - run a separate compiler over that template, which will generate Python classes for you; just don't think that these classes are first class citizens that you can extend using inheritance, because they're not; - import the generated module containing those classes; - and now you have you're very own private pickle-like format, yay! I'm sure that this has its uses for big, complex projects, but for lightweight needs, it seems over-engineered and unPythonic. -- Steve -- https://mail.python.org/mailman/listinfo/python-list