Steven D'Aprano wrote: > On Sun, 26 Jun 2005 23:22:00 -0500, Terry Hancock wrote: > >>>You need to differentiate >>> a = b = 1 >>>from >>> a = b == 1 >> >>Okay, I see what you mean. I can't ever recall having needed the >>second form, though. >> >>Of course, you could still do assignment like this: >> >>a, b = (1,)*2 >> >>But I guess that's not exactly elegant. ;-) > > In general that is not the same thing as a = b = obj. > > py> a, b = ([], []) > py> a.append(1) > py> b > [] > py> a = b = [] > py> a.append(1) > py> b > [1]
What you wrote isn't, but what Terry wrote is. In [1]: a, b = ([],)*2 In [2]: a.append(1) In [3]: b Out[3]: [1] In [4]: a is b Out[4]: True -- Robert Kern [EMAIL PROTECTED] "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter -- http://mail.python.org/mailman/listinfo/python-list