(no title)
throwaway91919 | 10 years ago
def foo(x=[]):
sum = 0
for a in x: sum += a
return sum
print foo([3,5]) # 8
print foo(x=[3]) # 3
print foo([]) # 0
print foo() # 0
Is it the fact that kwargs are required to have defaults? Or what?
saltylicorice|10 years ago
throwaway91919|10 years ago
raverbashing|10 years ago
def foo(i,x=[]):
foo(1)foo(2)
See what happens