On 9/5/14 1:16 PM, Marko Rauhamaa wrote:
MRAB <pyt...@mrabarnett.plus.com>:
Therefore, if you want it to be able to drop it into Python's REPL, it
won't be compatible with JSON anyway! (Well, not unless you define
'true' and 'false' first.)
Sigh. I was so hopeful JSON would be great. Unfortunately, it flopped by
requiring the parser to heuristically support 5 encoding systems.
I don't understand how JSON has flopped? The parser may be a bit more
complex (but not much, it isn't hard to examine the first few bytes),
but you're using off-the-shelf parsers anyway, so why are you concerned
by this?
Thus, ast.literal_eval() is superior to anything JSON has to offer.
Marko
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list