MaildirMessage

Tzury Afro.Systems at gmail.com
Sat Jul 14 11:26:43 CEST 2007


> What do you actually think
>
> ...     for m in msg:
> ...             print m
>
> should do? Why do you believe that what you think it should do would be
> a natural choice?

I needed to know how to extract particular parts of a message, such as
the message 'body', 'subject', 'author', etc.
I couldn't find it in the documentation this kind of information until
I ran the inspect.getmembers(msg) and found out that the message body
stored in _payload. that is msg._payload is the content of the
message.

Regarding the *bug* thing it is very simple. If you iterate an int you
get an exception <TypeError: 'int' object is not iterable>, clear
enough. Yet here I got the following exception <AttributeError: 'int'
object has no attribute 'lower'> which suggest an attempt to iterate
---. I do think that a message should support iteration for the very
fact that each can contain a different type and amount of headers, and
iteration in this case will make application's code clean and unified.




More information about the Python-list mailing list