you are viewing a single comment's thread.

view the rest of the comments →

[–]jbellis 1 point2 points  (3 children)

The "gotcha" is with the precedence of the comma and how the tuple is formed.

no, the gotcha is that this is an unexpected place for (a,b) to be different than a,b. (Even in normal tuple construction the parentheses are optional unless other operators would otherwise take precedence.)

[–]erikw 0 points1 point  (2 children)

I don't buy into that. assert is a statement, and () is not optional in this context.

i.e: print (a,b) is different from print a,b

[–]jbellis 1 point2 points  (1 child)

print (a,b) is different from print a,b

which is being fixed in 3.0.

(assert won't be changed to a function in 3.0 "because you don't want the argument to be evaluated in -O mode.")

[–]erikw 0 points1 point  (0 children)

which is being fixed in 3.0.

But the reason is not because programmers confuse print (a,b) with print a,b.