[Python-Dev] Dropping bytes "support" in json
Chris Withers
chris at simplistix.co.uk
Sat Apr 11 14:46:18 CEST 2009
glyph at divmod.com wrote:
>
> My preference would be that
>
> message.headers['Subject'] = b'Some Bytes'
>
> would simply raise an exception. If you've got some bytes, you should
> instead do
>
> message.bytes_headers['Subject'] = b'Some Bytes'
Remind me again why you need to differentiate between headers and
bytes_headers?
I think bytes headers are evil. If you don't know the encoding when you
have one, who does or ever will?
> message.headers['Subject'] = Header(bytes=b'Some Bytes',
> encoding='utf-8')
>
> Explicit is better than implicit, right?
Indeed, and the case for the above would be to keep indempotence of
incoming messages in applications like mailman...
...otherwise we could just decode them and be done with it.
cheers,
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
More information about the Python-Dev
mailing list