Sharing mutable objects
through variables
a = [1,2]; b = a; a.append(3); print b
as default arguments
def add(a, list=[]):
list.append(a); return list
as class attributes
class TreeNode:
children = []
...
Previous slide
Next slide
Back to first slide
View graphic version