3 ms·
It kind of works in Python 3.9 and perhaps earlier, unfortunately need extra parentheses ... >>> print((v1 := 2 * 3) * (v2 := 7)) 42 >>> print(v1) 6
by nwatson 6y ago
It kind of works in Python 3.9 and perhaps earlier, unfortunately need extra parentheses ...
>>> print((v1 := 2 * 3) * (v2 := 7))
42
>>> print(v1)
6
>>> print(v2)
7
edit: formatting