[Tutor] function return values
Peter Otten
__peter__ at web.de
Fri Dec 3 12:14:33 EST 2021
On 03/12/2021 08:04, Cameron Simpson wrote:
> _However_, the == operator binds more tightly that the , operator. So
> this:
>
> if item, row, column_list == None, None, None:
>
> is actually a 5-tuple:
>
> item
> row
> column_list==None
> None
> None
>
> Being a non-empty tuple, it is always true. Not what you wanted to test.
I believed you, but something made me feed this to the interpreter:
>>> 1, 2 == 3, 4
(1, False, 4)
>>> if 1, 2 == 3, 4: print("equal")
SyntaxError: invalid syntax
So the unsuspecting writer gets one more chance to put the parens into
the right places ;)
More information about the Tutor
mailing list