Message268409
| Author |
martin.panter |
| Recipients |
adrien-saladin, barry, berker.peksag, kxroberto, martin.panter, python-dev, r.david.murray, rhettinger |
| Date |
2016年06月13日.00:09:40 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1465776580.57.0.456405221178.issue10839@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
There are already the makings of an alternative API:
https://docs.python.org/3.6/library/email.message.html#email.message.Message.add_header
There is also replace_header(), but it only replaces the _first_ header field, and leaves later ones untouched. However there is only __del__(), which deletes all matching header fields; there is no remove_header() or similar.
I think I would support deprecating the __setitem__() etc methods, perhaps with a cleanup of the alternatives, e.g. add remove_all(). Also, __getitem__() is equivalent to get(), which does not raise KeyError. Although according to Issue 12111, David said things are unlikely to change. |
|