The following code has bitten me recently:

>>> t=(0,1)
>>> x,y=t if t else 8, 9
>>> print(x, y)
(0, 1) 9

I was assuming that a comma has the highest order of evaluation, that is the expression 8, 9 should make a tuple. Why this is not the case?

George


--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to