[Web-SIG] Time a for JSON parser in the standard library?
Bob Ippolito
bob at redivi.com
Thu Apr 10 07:15:21 CEST 2008
On Wed, Apr 9, 2008 at 8:04 PM, John Millikin <jmillikin at gmail.com> wrote:
> 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.
That sounds like a really bad idea, if there is an option to change
the behavior it shouldn't live in module state.
-bob
More information about the Web-SIG
mailing list