I'm trying to understand the walrus assignment operator.
Classic while loop breaks when condition is reassigned to False within the loop.
x = True
while x:
print('hello')
x = False
Why doesn't this work using the walrus operator?
It ignores the reassignment of x producing an infinite loop.
while x := True:
print('hello')
x = False
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…