[Web-SIG] Time a for JSON parser in the standard library?

John Millikin jmillikin at gmail.com
Thu Apr 10 05:04:04 CEST 2008


On Wed, Apr 9, 2008 at 7:20 PM, Ian Bicking <ianb at colorstudy.com> wrote:
>  I prefer liberal, with an option to turn on warnings or be strict.
>  Potentially warnings could be turned on by default, and turned off with
>  the warnings module.  (Is there a way to have a warning raise an
>  exception by default?  I only know of the command-line option to the
>  interpreter.)
>
I forgot about the warnings module.

For "exception by default" behavior, the library can call
warnings.simplefilter ("error", JSONWarning) on initialization. Then
we just define various subclasses of JSONWarning for the different
warning types (trailing comma, illegal whitespace, NaN etc). If users
want to ignore some or all of the warnings, they can specify which (or
all). Best of all, it wouldn't require long parameter lists.


More information about the Web-SIG mailing list