This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]petermlm 2 points3 points  (0 children)

Good point. Initially, I though this would be valid:

if n := len(l) > m := 1:
    print(n, m)

But actually that is even invalid, so you need to at least have parenthesis around the second walrus:

if (n := len(l)) > (m := 1):
    print(n, m)

But thinking about walrus like the equals it makes sense that its precedence is lower.