News for hackers. Stuff that matters.
Re:What’s New in Python 3.8 by xg15 on Tuesday October 15, 2019 @02:54AM (#21256137)
I think there are a lot of use-cases for some kind of dedicated "if-with-outputs" syntax, where you have some extra variables available inside the if-block if the condition matched. Such a syntax could cover a lot of the problems of double execution but also prevent hard to understand code like the walrus operator.

... I've got no idea how the syntax could look though.

Re:What’s New in Python 3.8 by Sean1708 on Tuesday October 15, 2019 @03:17AM (#21256251)
How would this hypothetical syntax differ from the walrus operator? I.e. what is hard to understand with the walrus operator that wouldn't be with this new hypothetical syntax and why?
Re:What’s New in Python 3.8 by xg15 on Wednesday October 16, 2019 @02:22AM (#21267604)
I think it could avoid cases where you "abuse" the walrus operator and make code harder to understand than necessary. E.g. things like:

  if (value := func()) and another_condition:
    ...
Or:

  if another_condition or (value := func()):
    ...
Or:

  x=1
  my_list = [x := x+1, x := x-1]
etc.
Re:What’s New in Python 3.8 by Sean1708 on Wednesday October 16, 2019 @07:06AM (#21269079)
Ah ok, so you'd essentially allow it in fewer contexts? I would definitely have supported that, although I do think combining walrus with other boolean expressions in if and while is super useful and not particularly hard to understand.