Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29882
| References | <5126348a-8e87-493d-975c-d6273e59784c@googlegroups.com> <b6555e91-54ba-42fb-bd99-561cb971c2ce@googlegroups.com> <505FAFCF.6030502@tysdomain.com> |
|---|---|
| Date | 2012-09-24 11:52 +1000 |
| Subject | Re: List Problem |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1175.1348451545.27098.python-list@python.org> (permalink) |
On Mon, Sep 24, 2012 at 10:56 AM, Littlefield, Tyler <tyler@tysdomain.com> wrote: > I've not been following this thread fully, but why not just use x=list(y) to > copy the list? > The issue is that when you assign i=[1,2,3] and then j = i, j is just a > reference to i, which is why you change either and the other changes. The problem is with lists as elements of that list, so the key is deepcopy. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
List Problem jimbo1qaz <jimmyli1528@gmail.com> - 2012-09-23 14:31 -0700
Re: List Problem jimbo1qaz <jimmyli1528@gmail.com> - 2012-09-23 14:44 -0700
Re: List Problem Chris Angelico <rosuav@gmail.com> - 2012-09-24 07:57 +1000
Re: List Problem Dave Angel <d@davea.name> - 2012-09-23 18:03 -0400
Re: List Problem Chris Angelico <rosuav@gmail.com> - 2012-09-24 08:27 +1000
Re: List Problem Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-23 22:37 +0000
Re: List Problem Chris Angelico <rosuav@gmail.com> - 2012-09-24 08:45 +1000
Re: List Problem Chris Angelico <rosuav@gmail.com> - 2012-09-24 08:30 +1000
Re: List Problem "Littlefield, Tyler" <tyler@tysdomain.com> - 2012-09-23 18:56 -0600
Re: List Problem Chris Angelico <rosuav@gmail.com> - 2012-09-24 11:52 +1000
Re: List Problem Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-23 22:07 +0000
Re: List Problem jimbo1qaz <jimmyli1528@gmail.com> - 2012-09-23 15:44 -0700
csiph-web