On Fri, Oct 26, 2012 at 6:03 PM, Cameron Simpson <c...@zip.com.au> wrote: > Any doco would need to make it clear that no order of operation is > implied, so that this: > > x = 1 > y = (2 as x) + x > > does not have a defined answer; might be 2, might be 3. Just like any > other function call with side effects.
But function calls with side effects _do_ have a defined order of evaluation. Left to right. And the answer should be 4. http://docs.python.org/reference/expressions.html#evaluation-order >>> def set_(d, k, v): ... d[k] = v ... return v ... >>> d = {} >>> set_(d, 'x', 1) 1 >>> set_(d, 'y', set_(d, 'x', 2) + d['x']) 4 -- Devin -- http://mail.python.org/mailman/listinfo/python-list