+= on lists is an annoying one:
def myfunc(mylist):
mylist += [1,2,3]
is NOT the same as: def myfunc(mylist):
mylist = mylist + [1,2,3]
Try this on each of those definitions: a = [4,5,6]
myfunc(a)
print a
The first one mutates 'a', the second only reassigns (and discards) a temporary `mylist`.Put another way, += is not just syntactic sugar. With lists, it actually mutates the original list.