On 22/01/2008, John Morris <[EMAIL PROTECTED]> wrote: > 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. Massive potential for gotchas, especially with some of python's > cleverness in terms of scoping rules.
There is potential for gotchas, but it's reduced by the fact that integers and strings are both immutable. For example: >>> x = 'foo' >>> y = x >>> y is x # this tests whether x and y are different names for the same object True >>> y += 'bar' # this is equivalent to: y = y + 'bar' >>> y is x False >>> y, x ('foobar', 'foo') (this is why there is no '.append()' method for strings) -- John. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor