On Mon, 19 Oct 2009 at 15:39, Andrew McNamara wrote:
Just to ramble a little longer, it's been argued that we should give
up on idempotency, but I'm not convinced. I think people want to see
an email message they throw into the system come out the other end as
closely as possible (well, /exactly/ for well-formed messages).
I, for one, would be disappointed if we lost idempotency. If people want
a use-case, think of SpamBayes, where we read the message, do our best
to analyse it, then insert a header or two. If this mangled messages,
the email module would be nearly useless to SB.
You are referring here to invertability, rather than idempotence.
But it turns out that idempotence does have a meaning in the context
of the email module, so I think I need to remove 'depreciated' from
my glossary[1] entry for it, and explain what it means in the context
of the email module.
For background, see issue 7119[2].
Here's what I propose: _invertability_ applies to the data path
into the parser and out of the generator. That is:
generate(parse(msg)) == msg
should be true whenever possible.
On the other hand, when _constructing_ a message, sometimes not all data
is filled in (in the example above, it is the MIME boundary marker).
In that case, it is important (I think, please discuss :) that generating
the message maintain _idempotency_: once you have generated the message,
then if you have not further mutated the message, generating the message
again should produce the _same_ output. That is:
generate(msg) == generate(msg)
even though the state of msg may change after the _first_ generate call.
--David
[1] http://wiki.python.org/moin/Email%20SIG/Glossary
[2] http://bugs.python.org/issue7119
_______________________________________________
Email-SIG mailing list
Email-SIG@python.org
Your options:
http://mail.python.org/mailman/options/email-sig/archive%40mail-archive.com