[Tutor] dictionaries, objects and scoping...

John Morris jrmorrisnc at gmail.com
Tue Jan 22 03:31:50 CET 2008


Thanks,

so I could/should do

self.ot = Bar(self.name.copy()) instead


On Jan 21, 2008 9:25 PM, Kent Johnson <kent37 at tds.net> wrote:

> John Morris wrote:
>
> > Why does the pop in the Bar class nuke the srv k & v from Foo.name
> > <http://Foo.name> as well?
>
> Because they are both names for the same dict.
>
> Assignment in Python does not copy values; it binds a name to a value.
> Some good references:
> http://effbot.org/zone/python-objects.htm
>
> http://groups.google.com/group/comp.lang.python/browse_thread/thread/56e7d62bf66a435c/
>
> Kent
>



-- 
John Morris
jrmorrisnc at gmail.com
"Do nothing which is of no use." -- Miyamoto Musashi
<a href="http://profile.mygamercard.net/nerdality">
<img src="http://card.mygamercard.net/gbar/abyss/nerdality.gif" border=0>
</a>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080121/c86b2d0e/attachment.htm 


More information about the Tutor mailing list