对不起,我不明白你想做什么。例如,这一行:
assert not all(thread.join() for thread in threads)
这根本没道理。
.join()
总是
返回
None
,所以和
assert not all(None for thread in threads)
除了它有连接螺纹的副作用。
all()
第一次看到故障时短路
False
价值,哪个
没有一个
是的,所以只有第一个
.加入
实际上叫。
all(...)
返回
错误的
所以
not all(...)
返回
True
,所以
assert
成功了。就像:
threads[0].join()
assert True
短期课程:
任何
代码是否关注值
thread.join()
回报很可能是断断续续的,因为
没有一个
是它唯一能看到的价值。