[Python-Dev] Status of json (simplejson) in cpython

Antoine Pitrou solipsis at pitrou.net
Sat Apr 16 18:37:25 CEST 2011


On Sat, 16 Apr 2011 18:04:53 +0200
Stefan Behnel <stefan_ml at behnel.de> wrote:
> 
> Well, if that is not possible, then the CPython devs will have a hard time 
> maintaining the json accelerator module in the long run. I quickly skipped 
> through the github version in simplejson, and it truly is some complicated 
> piece of code. Not in the sense that the code is ununderstandable, it's 
> actually fairly straight forward string processing code, but it's so 
> extremely optimised and tailored and has so much code duplicated for the 
> bytes and unicode types (apparently following the copy+paste+adapt pattern) 
> that it will be pretty hard to adapt to future changes of CPython, 
> especially the upcoming PEP 393 implementation.

Well, first, the Python 3 version doesn't have the duplicated code
since it doesn't accept bytes input. Second, it's not that complicated,
and we have already brought improvements to it, meaning we know the
code ("we" is at least Raymond and I). For example, see
http://bugs.python.org/issue11856 for a pending patch.

> Maintaining this is clearly no fun.

No more than any optimized piece of C code, but no less either.
It's actually quite straightforward compared to other classes such as
TextIOWrapper.

PEP 393 will be a challenge for significant chunks of the interpreter
and extension modules; it's not a json-specific issue.

Regards

Antoine.




More information about the Python-Dev mailing list