[Email-SIG] fixing the current email module
Barry Warsaw
barry at python.org
Fri Oct 9 15:21:17 CEST 2009
On Oct 9, 2009, at 2:26 AM, Glenn Linderman wrote:
> Then the Postel principle is un-Pythonic, and to be Pythonic any
> incorrect email should produce an error, and be unreadable. Again, I
> mentioned producing a defect report. That is not passing an error
> silently.
There's no conflict between principles here if you keep clear in your
mind the two different patterns we're talking about. When parsing raw
data, we soldier on in the face of errors as best we can, never
raising exceptions, but recording defects. When manipulating the
model, we throw exceptions as early as possible because these are
application errors and the client controls the application.
> The un-Pythonic thing is returning defect reports instead of raising
> errors. There is no way for a simple assignment interface to return
> an error, because the API for simple assignment doesn't have an in-
> band signaling mechanism.
This "assignment interface" falls under "manipulating the model". It
does reveal an important point though: the parser may not be able to
use the same API that model manipulation uses. It may need to use a
lower-level (read: more permissive) interface to the model. The
current parser mostly works well though because the current model
doesn't do any standards checking. Wanna create a 10k Subject
header? Fine! In practice this works well, so perhaps we need to
think about how "RFC enforcement" can be overlaid on the model.
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 832 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/email-sig/attachments/20091009/84c3e1a6/attachment.pgp>
More information about the Email-SIG
mailing list