From: tutor-bounces+ramit.prasad=jpmchase@python.org
[mailto:tutor-bounces+ramit.prasad=jpmchase@python.org] On Behalf Of naheed
arafat
Sent: Monday, July 25, 2011 10:17 AM
To: Steven D'Aprano
Cc: Tutor@python.org
Subject: Re: [Tutor] Copying Variables
I got a question in this co
On 25 July 2011 17:17, naheed arafat wrote:
> I got a question in this context.
> suppose
> a={'a': 3, 'b': [1, 2], 5: 100}
> --b=a -- vs--
> b=copy.copy(a)
>
> b[5]=6
I got a question in this context.
suppose
a={'a': 3, 'b': [1, 2], 5: 100}
--b=a --vs--
b=copy.copy(a)
b[5]=6 b[5]=6
output: --
Ryan Strunk wrote:
Hello everyone,
How can I make two copies of a dictionary that don't point to the same
location in memory? My plan is to generate d1 and make d2 a copy of d1.
After the user modifies d1 I want him/her to be able to return to the
initial dictionary (d2) values. I tried:
d1 = {va
Hello everyone,
How can I make two copies of a dictionary that don't point to the same
location in memory? My plan is to generate d1 and make d2 a copy of d1.
After the user modifies d1 I want him/her to be able to return to the
initial dictionary (d2) values. I tried:
d1 = {values}
d2 = dict(d1)
t