[Python-Dev] Dropping bytes "support" in json
James Y Knight
foom at fuhm.net
Mon Apr 13 21:11:37 CEST 2009
On Apr 13, 2009, at 10:11 AM, Barry Warsaw wrote:
> The email package does not need a parser for every header, but it
> should provide a framework that applications (or third party
> libraries) can use to extend the built-in header parsers. A bare
> minimum for functionality requires a Content-Type parser. I think
> the email package should also include an address header (Originator,
> Destination) parser, and a Message-ID header parser. Possibly others.
Sure, that's fine...
> The default would probably be some unstructured parser for headers
> like Subject.
But for unknown headers, it's not a useful choice to return a "str"
object. "str" is just one possible structured data representation for
a header: there's no correct useful decoding of all headers into str.
Of course for the "Subject" header, str is the correct result type,
but that's not a default, that's explicit support for "Subject". You
can't correctly decode "To" into a str, so what makes you think you
can decode "X-Gabazaborph" into str?
The only useful and correct representation for unknown (or
unimplemented) headers is the raw bytes.
James
More information about the Python-Dev
mailing list