Heated discussion on python-dev regarding proposed PEP 572

2 points by 21 ↗ HN
A lot of drama regarding a new syntax proposal (which I fell is terrible) which allows assignment in expressions:

while (value := read_next_item()) is not None:

assert 0 == (x := (y := (z := 0)))

stuff = [[y := f(x), x/y] for x in range(5)]

1 comment

[ 3.2 ms ] story [ 10.2 ms ] thread
Link?

In principle, I like it. But I don't think it's worth the cost of making the change. Python is accumulating a lot of stuff you have to know but that isn't that valuable. Don't want it to end up like C++.

Also, the second and third examples wouldn't be idiomatic, and I believe there's already a better way to write the first.