New submission from Efanzh :
The `headers` argument of the `__init__` method of `urllib.request.Request`
class uses `{}` as default value, which is mutable. It is not a good idea.
--
components: Library (Lib)
messages: 355750
nosy: EFanZh
priority: normal
pull_requests: 16537
severity
Efanzh added the comment:
How about changing `if headers` to `if headers is not None`?
--
___
Python tracker
<https://bugs.python.org/issue38654>
___
___
Pytho
Efanzh added the comment:
I agree that this doesn’t fix any bug. But is is easy to make mistakes by using
mutable default values (See
https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments). Both
PyCharm and pylint show warnings about mutable default arguments even there is