[Web-SIG] simplejson 2.0.0 released, much faster.
arnarbi at gmail.com
Sat Sep 27 23:10:32 CEST 2008
On Sat, Sep 27, 2008 at 22:13, Bob Ippolito <bob at redivi.com> wrote:
> If you give it unicode input, it will decode to unicode. Basically it
> scans through the str until it finds non-ASCII, escape, or end quote.
> If it finds the end quote first it will just allocate a new string
> with exactly that day, which is super fast since it's just an alloc
> and copy.
> It will of course always decode everything containing non-ASCII
> characters or any escape sequences to unicode. It is not currently
> configurable. It was done for performance, but also does produce nicer
> looking repr output because you don't have so many 'u' characters to
> look at :) Given the way str works in Python 2.x it should not be an
> incompatible change except for doctests... and I guess code that
> explicitly checks for unicode and doesn't know what to do with str,
> but that would be weird.
The reason I asked was because I've had problems even with pure-ASCII
strs when mixed with unicode objects in some DB-API drivers, working
with filesystems on the OS-X and others. A "solution" was to have
everything in unicode.
Since that means the string given to simplejson to decode will be a
unicode string anyways, so in that case there's no problem :)
More information about the Web-SIG