python - Turning a list or user generated strings into a single string -
i'm getting input users list of strings, ie:
['a','b','c','d']
the strings "hat" short essay. need store list in database string, , pull string out , turn list later. advice on safest / fastest way this? far i've considered:
my preference, far, msgpack (and xml). has canonical interface protocol.dumps
/protocol.loads
similar json
, support python base types similar json
, other packing libs.
json
readable both human , programs, lot of tools e.g. jsonselect or postgresql.pickle
handy complex python types/classes #lazymsgpack
performant speed & space wise. can swap json , it's not "bloated". works great utf-8.csv
ok lists , tables. it's more compact json , easy parse when it's under control #security. can save some cpu cyles & bandwidth. doesn't support nested lists default.xml
portable, verbose, validation frameworks makes easier understand. has loads of tools.
using longish delimiter string
this looks using "rare" character, can break. , if matters, longish thing can make performance burden.
neo4j
since using neo4j it's better go json easier compatibility explorer.
tips: never use list
in protocols, it's have smallest possible messages when there bug it's unreadable or clutter code. backward compatibility burden. prefer dict
represent objects , list
represent real lists or set
object. using dictionary allow application/protocol self-document. http 1.x that.
Comments
Post a Comment