[Tutor] dictionaries, objects and scoping...

Kent Johnson kent37 at tds.net
Tue Jan 22 03:25:21 CET 2008


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


More information about the Tutor mailing list