On Wed, Apr 9, 2008 at 11:01 PM, John Millikin <[EMAIL PROTECTED]> wrote:
> On Wed, Apr 9, 2008 at 10:15 PM, Bob Ippolito <[EMAIL PROTECTED]> wrote:
> > That sounds like a really bad idea, if there is an option to change
> > the behavior it shouldn't live in module state.
> >
> Would you rather have strictness controls as parameters? demjson
> currently has seventeen of those. Maybe we could have loads(bytes) and
> loads_broken(bytes, allow_trailing_comma, allow_all_whitespace,
> allow_comments, ...) functions, one for parsing JSON, the other for
> parsing garbage. There's no real way to hide or remove the complexity
> in parsing invalid data, so both warnings and parameters will cause
> the implementation to be much larger, but at least having to call
> warnings.filter ("ignore", JSONWarning) might serve to make some users
> think twice.
>
Yeah just like sys.setdefaultencoding, look at how well that worked out.
simplejson has a number of options that you can pass to loads and
dumps, but if you don't explicitly use any of them it does what most
people want by default. I don't see a "loose=True" being much worse, I
probably wouldn't allow people to pick and choose exactly which
garbage to allow (except for the spec ambiguities that it already
gives you control over).
-bob
_______________________________________________
Web-SIG mailing list
[email protected]
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe:
http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com