mirror of https://github.com/python/cpython
gh-100792: Make `email.message.Message.__contains__` twice as fast (#100793)
This commit is contained in:
parent
47b9f83a83
commit
6746135b07
|
@ -448,7 +448,11 @@ class Message:
|
|||
self._headers = newheaders
|
||||
|
||||
def __contains__(self, name):
|
||||
return name.lower() in [k.lower() for k, v in self._headers]
|
||||
name_lower = name.lower()
|
||||
for k, v in self._headers:
|
||||
if name_lower == k.lower():
|
||||
return True
|
||||
return False
|
||||
|
||||
def __iter__(self):
|
||||
for field, value in self._headers:
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Make :meth:`email.message.Message.__contains__` twice as fast.
|
Loading…
Reference in New Issue