Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #81509

Re: FW: Unexpexted behaviot of python operators on list

From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.python
Subject Re: FW: Unexpexted behaviot of python operators on list
Date 2014-11-25 13:07 +0000
Organization A noiseless patient Spider
Message-ID <m51uvc$kcs$2@dont-email.me> (permalink)
References <mailman.16274.1416907513.18130.python-list@python.org> <54746a98$0$12990$c3e8da3$5496439d@news.astraweb.com> <mailman.16277.1416918045.18130.python-list@python.org>

Show all headers | View raw


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

Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

FW: Unexpexted behaviot of python operators on list "PANDEY2 Archana (MORPHO)" <archana.pandey.2@morpho.com> - 2014-11-25 10:23 +0100
  Re: FW: Unexpexted behaviot of python operators on list Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-25 22:40 +1100
    Re: FW: Unexpexted behaviot of python operators on list Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-11-25 12:20 +0000
      Re: FW: Unexpexted behaviot of python operators on list Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-25 13:07 +0000

csiph-web