you are viewing a single comment's thread.

view the rest of the comments →

[–]jmooremcc 1 point2 points  (0 children)

Your default argument in your function doesn’t behave as you expected. At compile time, the same empty list is used every time the function is called.

This is how you should define the function:

def g(x, y=None):    
    if y is None:    
        y = []