"Mark T" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | This is interesting: | | >>> class Test(object): | ... def __getattribute__(self,n): | ... print 'reading',n | ... return object.__getattribute__(self,n) | ... def __setattr__(self,n,v): | ... print 'writing',n,v | ... return object.__setattr__(self,n,v) | ... | >>> x=Test() | >>> x.a=1; x.b=2; x.c=3 | writing a 1 | writing b 2 | writing c 3 | >>> x.a=x.b=x.c | reading c | writing a 3 | writing b 3 | >>> | | I wouldn't have expected "a" to be assigned first in a right-to-left parsing | order. The result is the same in any case.
The assignment order is specified in the language reference. But many never read and those who do can forget. And even if the coder reads and remembers, a code reader may not have. Which is why I suggested multiple statements in explicit order when it really matters. tjr -- http://mail.python.org/mailman/listinfo/python-list