---
title: "Discussion on \"Python mutable default arguments: why your list keeps growing (tested examples)\" | Hashnode"
description: "Discussion on \"Python mutable default arguments: why your list keeps growing (tested examples)\". A list that keeps growing between function calls is one of the most common Python surprises in exams and interviews. Here is why it happens, with output I ran on Python 3.10.\nThe bug\ndef add_bad(x, bu"
url: "https://hashnode.com/posts/python-mutable-default-arguments-why-your-list-keeps-growing-tested-examples/6ad45da223a23d124ebbbd3e"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Python mutable default arguments: why your list keeps growing (tested examples)](https://techvani.hashnode.dev/python-mutable-default-arguments-why-your-list-keeps-growing-tested-examples?utm_source=hashnode&utm_medium=feed)

A list that keeps growing between function calls is one of the most common Python surprises in exams and interviews. Here is why it happens, with output I ran on Python 3.10. The bug def add\_bad(x, bu

Oct 18 · 2 min read · techvani.hashnode.dev  
Read the article

-   [#python](https://hashnode.com/tag/python)
-   [#programming-ciovqvfcb008mb253jrczo9ye](https://hashnode.com/tag/programming-ciovqvfcb008mb253jrczo9ye)
-   [#tutorial](https://hashnode.com/tag/tutorial)
-   [#beginners](https://hashnode.com/tag/beginners)

## Written by

[Aditya](https://hashnode.com/@techvani-ai)

@techvani-ai

  
[View profile](https://hashnode.com/@techvani-ai)

Notes, lab files and revision videos. Telegram: t.me/techvaniai

BTech CSE student. Notes, lab files and revision videos. Telegram: https://t.me/techvaniai

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
