Re: multiple assignments (was: My first Python program)

2010-10-14 Thread Ian Kelly
On Wed, Oct 13, 2010 at 3:53 PM, Ethan Furman wrote: > Ian Kelly wrote: > >> here is an example >> where the order of assignment actually matters: >> >> >>> d['a'] = d = {} >> Traceback (most recent call last): >> File "", line 1, in >> NameError: name 'd' is not defined >> >>> d = d['a'] =

multiple assignments (was: My first Python program)

2010-10-14 Thread Ethan Furman
Ian Kelly wrote: here is an example where the order of assignment actually matters: >>> d['a'] = d = {} Traceback (most recent call last): File "", line 1, in NameError: name 'd' is not defined >>> d = d['a'] = {} >>> d {'a': {...}} As you can see, they're assigned left-to-right. Ah!