Why does changing 1 list affect the other?

From: oom (oom_at_xxnospamxx.ps.gen.nz)
Date: 11/06/03


Date: Thu, 06 Nov 2003 16:36:08 +1300

I am a bit of a newbie when it comes to python, when working with
lists today I noticed some very odd behaviour, any suggestions
welcome:

Python 2.2.3 (#1, Nov 6 2003, 14:12:38)
[GCC 3.3.2 20031022 (Gentoo Linux 3.3.2-r2, propolice)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> firstlist=['item1','item2','item2']
>>> secondlist=firstlist
>>> print (firstlist,secondlist)
(['item1', 'item2', 'item2'], ['item1', 'item2', 'item2'])
>>> firstlist[0]='strangeness'
>>> print (firstlist,secondlist)
(['strangeness', 'item2', 'item2'], ['strangeness', 'item2', 'item2'])
>>>

why does altering one list affect the other list ? it is driving me
insane!