[issue10839] email module should not allow some header field repetitions

Raymond Hettinger report at bugs.python.org
Sun Jun 12 17:19:07 EDT 2016


Raymond Hettinger added the comment:

Would you consider raising an exception at least for the case of a "To:" header or perhaps a warning or someother failsafe.

Using __setitem__ for appending instead of replacement is surprising and in the case of LetsEncrypt was a small disaster.   There is a docstring explaining what is going on but that typically isn't visible to the user of the square brackets operator.

For Python3.6, I think there should be an alternative API that doesn't use the square brackets operator:   add_header, replace_header, remove_header or somesuch.  The problem is that square brackets never suggests appending which is what is actually happening.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10839>
_______________________________________


More information about the Python-bugs-list mailing list