Y
Hacker News
new
|
ask
|
show
|
jobs
by
majewsky
2904 days ago
I'm immediately skeptical after seeing this example because I'm not sure if the first line parses as:
if (x := f()) is not None:
or as:
if x := (f() is not None):
2 comments
sametmax
2904 days ago
That's why parenthesis are mandatory.
link
icebraining
2904 days ago
:= overrules everything except a comma, so it's the latter. Still, I agree it's potentially confusing.
link