On Wed, Oct 13, 2010 at 11:28 AM, Ethan Furman <et...@stoneleaf.us> wrote:
> Seebs wrote: > >> On 2010-10-12, Hallvard B Furuseth <h.b.furus...@usit.uio.no> wrote: >> > > > >> self.type, self.name = None, None >>>> >>> >> Actually you can write self.type = self.name = None, >>> though assignment statements are more limited than in C. >>> (And I think they're assigned left-to-right.) >>> >> > Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit > (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more information. > --> a = 2 > --> b = 7 > --> c = 13 > --> a = b = c = 'right to left' > --> a, b, c > ('right to left', 'right to left', 'right to left') > I'm not sure how that demonstrates anything, but here is an example where the order of assignment actually matters: >>> d['a'] = d = {} Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'd' is not defined >>> d = d['a'] = {} >>> d {'a': {...}} As you can see, they're assigned left-to-right. Cheers, Ian
-- http://mail.python.org/mailman/listinfo/python-list