bugbear21.4.3

B006 Do not use mutable data structures for argument defaults

Do not use mutable data structures for argument defaults. They are created during function definition time. All calls to the function reuse this one instance of that data structure, persisting changes between them.

Extra parameters

These are defined by flake8-bugbear in the code and define the behavior of the violation. That's why we decided to print them here, for your reference.
Parameter Value
mutable_calls
  • Counter
  • OrderedDict
  • collections.Counter
  • collections.OrderedDict
  • collections.defaultdict
  • collections.deque
  • defaultdict
  • deque
  • dict
  • list
  • set
mutable_literals
  • Dict
  • List
  • Set