Python Pitfalls

I was woken up today with the following question:

def foo(x=[]):
    return x

>>> foo()
>>> foo()

What could be the output? The answer is

[1, 1]

I was stupefied for a minute before I started DuckDuckGo-ing Python default arguments, Python garbage collection, Python pitfalls..etc.,

These links helped me understand mutable objects’ memory management.
Deadly Bloody Serious – Default Argument Blunders
Udacity Wiki – Common Python Pitfalls
Digi Wiki – Python Garbage Collection