from functools import reduce
print({1, 2} & {2, 3})
print(reduce(lambda x, y: x & y, [{1, 2}, {3, 4}, {2, 3}]))
output:
{2}
set()
1
itskingname 2019-07-30 17:14:39 +08:00
因为首先是{1, 2} & {3, 4}结果为{},然后{} & {2, 3}结果依然为{}
|
2
scalaer OP @itskingname 😯, 我蠢了
|