> ## Documentation Index
> Fetch the complete documentation index at: https://loadwise.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# python-mutated-mutable-default

> A function directly mutates an object shared as a default argument between calls.

## What it flags

A default list, dictionary or set is allocated when Python defines the function. A direct mutation in the function body updates the same object for later calls that omit the argument. Use per-call initialization where appropriate. Review whether shared caching is intentional and preserve distinct behavior for an explicit None argument.

A parameter named as a deliberate cache is not reported: `memo`, `_memo`, `cache`, `_cache`, or a name starting with `memo_` or ending in `_cache`, as in `def fib(n, memo={})`. Other names, such as `seen` or `visited`, are still reported.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.