そーいや代入の式ができていたのを忘れていた。PEP-572で定義されている。
>>> while a:= input(): ... print("input:", a) ... hello input: hello foo input: foo bar input: bar
こういう書き方ができるようになっている。:=は結合順が弱々しいので、a := b:= 2 みたいな書き方はできないし、式が要求されていることが自明なとこでなければ書けない。
>>> a:=0
File "<python-input-12>", line 1
a:=0
^^
SyntaxError: invalid syntax
>>> a = b:= 1
File "<python-input-2>", line 1
a = b:= 1
^^
SyntaxError: invalid syntax
>>> a = (b:= 1)
>>> a
1
簡潔には書けるがカッコが増えるとpythonぽくはなくなっていく気もするね。