John Morris wrote: > Ahhh. so namespaces are scoped, not objects... I would say names are scoped, but I guess namespaces are too.
> You have to keep your objects separate (and make copies when needed), Yes > Python just keeps namespaces (names that refer to an object) scoped > according to it's rules: > http://docs.python.org/ref/naming.html > > So if you create an object way up in terms of scope (global), then all > python does is handle what names are available in a given scope to refer > to it. If you want a separate object you have to take care of that > yourself. Efficient. Yes. Assignment is not copying, it is name-binding. > Massive potential for gotchas, especially with some > of python's cleverness in terms of scoping rules. In my experience it is rare to actually need a copy of an object, and usually pretty clear when I do. The real hurdle is getting your mental model in sync with what Python is actually doing, rather than what you think it should be doing. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor