zapier/flake8-mutable

Name: flake8-mutable

Owner: Zapier

Description: flake8 extension for mutable default arguments

Forked from: ebeweber/flake8-mutable

Created: 2017-09-29 05:11:11.0

Updated: 2017-09-29 05:11:13.0

Pushed: 2017-10-03 07:41:51.0

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

Size: 14

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

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
fnc(a, b={}):
pass

py:2:14: M511 - mutable default arg of type Dict
Installation
install flake8-mutable
Changes [1.1.0] 2016-11-26 [1.0.6] 2016-11-26 License

MIT


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.