Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ebeweber/flake8-mutable
flake8 extension for mutable default arguments
https://github.com/ebeweber/flake8-mutable
Last synced: 2 days ago
JSON representation
flake8 extension for mutable default arguments
- Host: GitHub
- URL: https://github.com/ebeweber/flake8-mutable
- Owner: ebeweber
- License: mit
- Created: 2016-05-11T05:31:39.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-06-29T15:16:55.000Z (over 4 years ago)
- Last Synced: 2024-09-27T04:29:02.631Z (about 1 month ago)
- Language: Python
- Homepage: https://pypi.python.org/pypi/flake8-mutable
- Size: 12.7 KB
- Stars: 44
- Watchers: 4
- Forks: 16
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- my-awesome-starred - ebeweber/flake8-mutable - flake8 extension for mutable default arguments (Python)
- awesome-flake8-extensions - flake8-mutable - Detect usage of mutable objects as default values for arguments. (Bugs)
- awesome-python-backend - _flake8-mutable_ - checks for mutable default parameter values Python issue (Topics Index / Code Quality and Linting)
README
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={}):
passfoo.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)