Appending to a list in an instantiated object
<p>I'm trying to append items to a list in an instantiated object:</p>

<pre><code>class Room(object):
    def __init__(self, name, contents=[]):
        self.name = name
        self.contents = contents


living_room = Room('living room')
dining_room = Room('dining room')

print(living_room.contents)  # []
print(dining_room.contents)  # []

living_room.contents.append('lamp')

print(living_room.contents)  # ['lamp']
print(dining_room.contents)  # ['lamp']
</code></pre>

<p>The behavior I would expect would be for the lamp to be in living_room.contents, but not in dining_room.contents. Can anyone explain this?</p>