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 <rep...@bugs.python.org>
<http://bugs.python.org/issue10839>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to