[Email-SIG] API for Header objects [was: Dropping bytes "support" in json]

Tony Nelson tonynelson at georgeanelson.com
Wed Apr 15 03:26:19 CEST 2009


At 18:11 +0900 04/14/2009, Stephen J. Turnbull wrote:
>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.

The examples in the RFC seem to use one or the other for the friendly name.
The problem comes when there are both.  Actually, I haven't seen comments
used, so I don't have any experience there.


>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).

Well, msg['To'] would return a list (or tuple) of addresses (which are
tuples), so msg['To'][0] would return the first such address, if any.  No
converter required.
-- 
____________________________________________________________________
TonyN.:'                       <mailto:tonynelson at georgeanelson.com>
      '                              <http://www.georgeanelson.com/>


More information about the Email-SIG mailing list