Default arguments in Python functions

This post is based on a gist I wrote a while ago, about why is not a good idea to pass de­fault mu­ta­ble ob­jects as pa­ram­e­ters in python func­tion def­i­ni­tion­s.

While the gist is ex­plained through an ex­am­ple that us­es list­s, the prin­ci­ple is ap­pli­ca­ble to all sorts of ob­jects (dic­tionar­ies, set­s, etc.).

If you are an ex­pe­ri­enced python de­vel­op­er, you prob­a­bly knew this caveat, nev­er­the­less is some­thing in­ter­est­ing to show to new python de­vel­op­er­s, and to re­mem­ber even if you have been writ­ing code in Python for years.