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.
-- Simplistix - Content Management, Zope & Python Consulting