Speed differences between intersection() and 'object for object in set if object in other_set'

后端 未结 4 1226
谎友^
谎友^ 2021-02-09 10:02

Which one of these is faster? Is one \"better\"? Basically I\'ll have two sets and I want to eventually get one match from between the two lists. So really I suppose th

4条回答
  •  醉话见心
    2021-02-09 10:45

    Your code is fine. Item lookup if object in other_set for sets is quite efficient.

提交回复
热议问题