[Python-Dev] Dropping bytes "support" in json

glyph at divmod.com glyph at divmod.com
Fri Apr 10 07:28:36 CEST 2009


On 03:21 am, ncoghlan at gmail.com wrote:
>Barry Warsaw wrote:

>>I don't know whether the parameter thing will work or not, but you're
>>probably right that we need to get the bytes-everywhere API first.

>Given that json is a wire protocol, that sounds like the right approach
>for json as well. Once bytes-everywhere works, then a text API can be
>built on top of it, but it is difficult to build a bytes API on top of 
>a
>text one.

I wish I could agree, but JSON isn't really a wire protocol.  According 
to http://www.ietf.org/rfc/rfc4627.txt JSON is "a text format for the 
serialization of structured data".  There are some notes about encoding, 
but it is very clearly described in terms of unicode code points.
>So I guess the IO library *is* the right model: bytes at the bottom of
>the stack, with text as a wrapper around it (mediated by codecs).

In email's case this is true, but in JSON's case it's not.  JSON is a 
format defined as a sequence of code points; MIME is defined as a 
sequence of octets.


More information about the Python-Dev mailing list