Python Gotcha's?

Tycho Andersen tycho at tycho.ws
Thu Apr 5 12:31:56 EDT 2012


On Thu, Apr 05, 2012 at 08:32:10AM -0400, Roy Smith wrote:
>
> One of the hardest things about writing parsers is generating helpful 
> error messages when things don't parse.  But, it's only of value to do 
> that when you're parsing something you expect to be written by a human, 
> and thus a human has to puzzle out what they did wrong.  Nobody expects 
> that a JSON parser will be parsing human-written input, so there's 
> little value to saying anything more than "parse error".

Except for the human that has to debug why something automatically
generated doesn't parse. That guy would probably appreciate a
reasonable error message. (And indeed, as a sibling poster points out,
people do write JSON by hand quite frequently.)

\t



More information about the Python-list mailing list