Posting this because it can save some lives. If you use an empty list or dictionary as a default argument in #python, the same list will be used every time. So every call will just update the mutable element instead of re-defining it as empty 😱
Most IDEs will give you a vague warning (PyCharm does) but nothing more so it can be very sneaky and dangerous!
CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.