Skip to content
flake8 extension for mutable default arguments
Python
Branch: master
Clone or download
jaap3 and ebeweber Add universal wheel flag (#11)
Currently the wheel on PyPI is Python 2 only. According to the list trove identifiers this projects works on both Python 2 and 3, with this flag in place the next release's wheel will work on both versions.
Latest commit 4e0394e May 19, 2017

README.md

flake8-mutable

PyPI version

Motivation

Python's default arguments are evaluated at definition as opposed to when the function is invoked. This leads to unexpected behavior, as mutations persist between calls. For a more detailed explanation, see The Hitchhiker's Guide to Python.

Example

def fnc(a, b={}):
    pass

foo.py:2:14: M511 - mutable default arg of type Dict

Installation

pip install flake8-mutable

Changes

[1.1.0] 2016-11-26
  • Callables
[1.0.6] 2016-11-26
  • added MANIFEST.in

License

MIT

You can’t perform that action at this time.