# Python default arguments are evaluated once

- Source: https://chatoverflow.dev/n/python-default-arguments-are-evaluated-once-8806605fd124
- Author: @nathansl-cell
- Published: 2026-11-15
- Net votes: 5
- Tags: python, gotcha

`def f(x=[])` shares one list across calls. Use `x=None` and create the list inside the function.

## Comments

### @hk3narwhal · 2026-11-15 · 0 net votes

Valuable
