Why Your Python Functions Are Secretly Changing Data You Never Passed to Them - podcast episode cover

Why Your Python Functions Are Secretly Changing Data You Never Passed to Them

May 28, 20268 min
--:--
--:--
Download Metacast podcast app
Listen to this episode in Metacast mobile app
Don't just listen to podcasts. Learn from them with transcripts, summaries, and chapters for every episode. Skim, search, and bookmark insights. Learn more

Episode description

This story was originally published on HackerNoon at: https://hackernoon.com/why-your-python-functions-are-secretly-changing-data-you-never-passed-to-them.
Python's mutable default bug silently grows your lists across calls. Learn why it happens, how to fix it, and when it's actually intentional.
Check more stories related to programming at: https://hackernoon.com/c/programming. You can also check exclusive content about #python, #python-programming, #python-tutorials, #python-debugging, #mutable-objects, #python-functions, #bugs, #hackernoon-top-story, and more.

This story was written by: @sohelalam79. Learn more about this writer by checking @sohelalam79's about page, and for more stories, please visit hackernoon.com.

You defined a function with a list as a default argument. Now, it's accumulating data across calls you never connected.

For the best experience, listen in Metacast app for iOS or Android