Re: API for Header objects [was: Dropping bytes "support" in json]

"Stephen J. Turnbull" <[email protected]>
Newsgroups gmane.comp.python.mime.devel
Message-ID <[email protected]>
Tony Nelson writes:

 > Assuming that by "Destination" you mean a class of Address header fields,
 > as there is no Destionation: header field, such header fields contain
 > addresses, which can be considered to contain (as the email package does) a
 > list of (name, email address) pairs, or, at a lower level, to also have
 > Comments, there is indeed only one correct choice, which is the one the
 > email package currently provides the diligent user.  I wish it to be the
 > one obvious choice, so that less study is needed to properly use the email
 > package.

As you point out above, display names and comments are different.
It's *not* obvious to me that they should be confounded by default.

In any case, it would certainly be possible to implement both the
indexing feature, so that msg['To'][0] returns a (display, mailbox)
tuple, and a converter so that list(msg['to']) returns a list of such
tuples (in both cases, assuming that most users prefer not to
distinguish comments from display names).
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.