Antoon Pardon wrote:

> The language reference doesn't talk about objects. And IMO you
> should be carefull if you want to use the word "object" here.
> In the line: "foo += 1", you can't talk about the object foo,
> since foo will

possibly

> be bound to a different object after the assignment
> than it was bound to before.

witness

   >>> class Foo(list) :
          def __iadd__(self,other) :
                  self.append(other)
                  return self

        
   >>> bar = foo = Foo()
   >>> foo += 1
   >>> foo is bar
   True
   >>> foo
   [1]

while of course

   >>> bar = foo = 0
   >>> foo += 1
   >>> foo is bar
   False

Best, BB
--
"On naît tous les mètres du même monde"
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to