Re: API thoughts

Barry Warsaw <[email protected]> Wed, 2 Mar 2011 16:12:06 -0500
Newsgroups gmane.comp.python.mime.devel
Organization Damn Crazy Followers of the Horn
Message-ID <[email protected]>
On Mar 01, 2011, at 08:45 PM, R. David Murray wrote:

>They don't.  The issue is that what we would like is for the email6 API
>for the address header to be that it looks like a list of Address objects.
>So msg['To'][0] would yield an address object.  But if we also want the
>header to look like a string, that won't work, because as a string that
>should yield the first character of the body of the header.

Here's where things get really interesting because you won't actually know
what msg[header][0] could return for any arbitrary value of 'header'.

For structured headers like To, msg['To'] can return an ordered sequence of
address objects, but what about msg['Received'] or msg['X-Happy-Fun-Ball']?
The same will go for anything like .addresses.

I'm not sure what the implications of this for the API are, but it's important
to keep in mind (I know RDM knows this) that structured headers need extra
parsing and will have more sophisticated objects representing them.

-Barry
signature.asc (application/pgp-signature, 836 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQIcBAEBCAAGBQJNbrKmAAoJEBJutWOnSwa/JTMP/jFUjxdZXyUTg7RUYX+vPF90
SJ+ReTgWRiivKmdyF2bAbAPyvrHSM6HjrZmCjnMHwCqzIaBiWnVj31lwPDiprWyx
1Cii4+nZ7XQorRVfsyCcUb8gyFrGJ7h/Ezfo/e77NxdsWngeTpaNyLnD2kW/8/Xo
b+tSsnzkVWXK7FFYeDg8bDGVbSCmTBwfg8o4/G4F72yyz0dOOIAQygnlXQFCsfMe
ytINWhhzEFSYSP126jMrQmzijYToZgG2boFkwNPL0Yt+x32Az6zlHKsAvzFfYsUI
vzp71c0a2LAmsM+z///4vONNHO0r3AFWz7Tagi/Lwb77Y+LSwOlSUe4msKIsE2nu
F2W+mKo3V8my7X6nbInSofA8ohsCY5Wg5Uc/1nq36QNAZEX12wP/3t7LmKfAbJdq
jMz5h88r+SeU8NC7vIWx2ZBXS0JsacS7AuCFJwFaYYlccxtk7ayT1xtZMojvU2tw
cjavk6p9J6pdBeYq0z4QySbXEqBnaMZsjwUDEVQaOdW2kKpiN0hzlyncefxkdjMC
t2ddRWWeiXBEWEtLe8YmBWB9Vj3Q55t+F5tonp8auuwpSlwRBpXxgj/jHE7rya3e
gqWKRJv2dwiXdWaDm/wNTkFttBff1/GzzN5K/EeWdL+vb6ZD7UBpawUeGJl060t5
A2OouvaJwzFyWayZhU1B
=U12A
-----END PGP SIGNATURE-----