You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: setup.py
+7-3Lines changed: 7 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,8 @@
37
37
38
38
- ``ser_bytes = serpent.dumps(obj, indent=False, set_literals=True, module_in_classname=False):`` # serialize obj tree to bytes
39
39
- ``obj = serpent.loads(ser_bytes)`` # deserialize bytes back into object tree
40
-
- You can use ``ast.literal_eval`` yourself to deserialize, but ``serpent.deserialize`` works around a few corner cases. See source for details.
40
+
- You can use ``ast.literal_eval`` yourself to deserialize, but ``serpent.deserialize``
41
+
works around a few corner cases. See source for details.
41
42
42
43
Serpent is more sophisticated than a simple repr() + literal_eval():
43
44
@@ -61,11 +62,14 @@
61
62
- Why not use XML? Answer: because XML.
62
63
- Why not use JSON? Answer: because JSON is quite limited in the number of datatypes it supports, and you can't use comments in a JSON file.
63
64
- Why not use pickle? Answer: because pickle has security problems.
64
-
- Why not use ``repr()``/``ast.literal_eval()``? See above; serpent is a superset of this and provides more convenience. Serpent provides automatic serialization mappings for types other than the builtin primitive types. ``repr()`` can't serialize these to literals that ``ast.literal_eval()`` understands.
65
+
- Why not use ``repr()``/``ast.literal_eval()``? See above; serpent is a superset of this and provides more convenience.
66
+
Serpent provides automatic serialization mappings for types other than the builtin primitive types.
67
+
``repr()`` can't serialize these to literals that ``ast.literal_eval()`` understands.
65
68
- Why not a binary format? Answer: because binary isn't readable by humans.
66
69
- But I don't care about readability. Answer: doesn't matter, ``ast.literal_eval()`` wants a literal string, so that is what we produce.
67
70
- But I want better performance. Answer: ok, maybe you shouldn't use serpent in this case. Find an efficient binary protocol (protobuf?)
68
-
- Why only Python, Java and C#/.NET, but no bindings for insert-favorite-language-here? Answer: I don't speak that language. Maybe you could port serpent yourself?
71
+
- Why only Python, Java and C#/.NET, but no bindings for insert-favorite-language-here? Answer: I don't speak that language.
72
+
Maybe you could port serpent yourself?
69
73
- Where is the source? It's on Github: https://github.com/irmen/Serpent
70
74
- Can I use it everywhere? Sure, as long as you keep the copyright and disclaimer somewhere. See the LICENSE file.
0 commit comments