I have done similar thing to myself in Python, sabotaging my own little project. The following is not a rare thing. Imagine this were initializing random key in TLS... But since Python syntax is arguably cleaner and more readable, it's easier to catch.
But that's a bet we have to put up with...
>>> def f(a,b=[]):
... b.append(a)
... return b
...
>>> print f(1)
[1]
>>> print f(1)
[1, 1]
>>> print f(1)
[1, 1, 1]
>>> import random
>>> def key():
... return random.randint(1,10000)
...
>>> def f2(a, b=key):
... return b()
...
>>> def f3(a, b=key()):
.... return b
>>> f2(1)
3974
>>> f2(1)
8684
>>> f3(1)
2867
>>> f3(1)
2867