4 ms·
In that case, by far the biggest Python gotcha is: def do_stuff(mylist=[]): mylist.append("thing") Which will lead to the list containing N items
by StavrosK 9y ago
In that case, by far the biggest Python gotcha is:
def do_stuff(mylist=[]):
mylist.append("thing")
Which will lead to the list containing N items after N invocations (i.e. the second function call won't start with an empty list).
- ammon 9y agoYup, we see that issue too. But in that case, I think it's python specific (how python handles default values). Ruby, for example, does not have that behavior.