Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Denis McMahon Newsgroups: comp.lang.python Subject: Re: FW: Unexpexted behaviot of python operators on list Date: Tue, 25 Nov 2014 13:07:57 +0000 (UTC) Organization: A noiseless patient Spider Lines: 28 Message-ID: References: <54746a98$0$12990$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Tue, 25 Nov 2014 13:07:57 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="66ffcfa4470a58bcddbdcd1913f98ab4"; logging-data="20892"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+w1tRbezh+I+gaulxf0D6mw1rA+jRTh3w=" User-Agent: Pan/0.136 (I'm far too busy being delicious; GIT 926a150 git://git.gnome.org/pan2) Cancel-Lock: sha1:QfKwukR6W2DFA99SG0yzvqhvcBE= Xref: csiph.com comp.lang.python:81509 On Tue, 25 Nov 2014 12:20:26 +0000, Mark Lawrence wrote: > a=[1,2,3] binds a to the list [1,2,3] > b=a binds b to a > b+=[4,5] Changes existing b, which is also a > x=[1,2,3] binds x to the list [1,2,3] > y=x binds y to x > y=y+[4,5] Binds y to a new list which comprises previous y plus [4,5] -- Denis McMahon, denismfmcmahon@gmail.com