pythonstatic-analysis

How to get a warning about a list being a mutable default argument?


I accidentally used a mutable default argument without knowing it.

Is there a linter or tool that can spot this and warn me?


Solution

  • flake8-bugbear, Pylint, PyCharm, and Pyright can detect this: