有 "+=" 运算符,即 int。
a = 5
a += 1
b = a == 6 # b is True
是否有布尔的“and=”运算符?
a = True
a and= 5 > 6 # a is False
a and= 5 > 4 # a is still False
我知道,这个 'and=' 运算符将对应于:
a = True
a = a and 5 > 6 # a is False
a = a and 5 > 4 # a is still False
但是,我经常做这个操作,我不认为它看起来很整洁。
谢谢