arnimarj / flake8-mutable

flake8 extension for mutable default arguments

Home Page:https://pypi.python.org/pypi/flake8-mutable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

flake8 extension for mutable default arguments

https://pypi.python.org/pypi/flake8-mutable

License:MIT License


Languages

Language:Python 100.0%