Alok Menghrajani

Security engineer at Square. Previously co-author of Hack and put the 's' in https at Facebook. Maker of CTFs.

Home | Contact me | Github | Twitter | Facebook

Python's default parameters don't get deep copied at call time:

def myfun(data=[]):
  data.append(1)
  return data

print myfun(), myfun(), myfun([]), myfun([])

Results in [1] [1, 1] [1] [1]