Skip to main content

mutable defaults flake8 extension

Project description

flake8-mutable
--------------

[![PyPI version](https://img.shields.io/pypi/v/flake8-mutable.svg)](https://pypi.python.org/pypi/flake8-mutable)

#### 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](http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments).

#### 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](https://opensource.org/licenses/MIT)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flake8-mutable-1.2.0.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

flake8_mutable-1.2.0-py2-none-any.whl (3.4 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page