On Tue, Oct 9, 2012 at 8:10 PM, Victor Manuel Quiñones Victor
<
quinone...@gmail.com> wrote:
> I need to serialize some objects and save them into the database. What
> library would you suggest for it?
there are a few options, each with different pros/cons. roughly in
order of personal preference:
JSON:
pro: works in any language, easy to read
con: not the fastest, not the most compact
pickle:
pro: quite fast, easy and very transparent on Python
con: python only
messagepack:
pro: very fast, very compact
con: depends on a not-so-common library
glob:
pro: very fast, very compact
con: go only
protocolbuffers:
pro: quite fast, very compact, multi-version compatibility
con: not widespread, limited language support
tnetstrings:
pro: quite fast, compact, somewhat readable
con: not widespread
yaml:
pro: simple, readable, readable on many languages
con: not compact
XML:
pro: many utilities, many languages
con: no need to enumerate...
in practce, i'd say: if it's absolutely, definitely python only, and
there's some real speed/size concerns, use pickle. for almost
everything else, JSON
--
Javier