aTuple = (100, 101, 102, 103)
for aBool in (False, True):
index = -1
if aBool:
print (aTuple [(index := index + 1)])
print (aTuple [(index := index + 1)])
print (aTuple [(index := index + 1)])
print (aTuple [index])
print ()
'''
Expected output:
100
101
100
101
102
102
True output:
100
100
100
101
102
102
'''
来自 C++,我期望后增量。但正如@chepner 指出的那样,索引会提前增加。哎呀...