What do you think this Python program prints?
def foo(x=[]):
Time's up! Did you think it prints this?
['hi']
If thats what you thought, then you're a reasonable person. But you're also incorrect. This is the actual output: ['hi']
Because Python default argument initializers are evaluated only once, and are mutable. How's that for a gotcha? Geez. |