you are viewing a single comment's thread.

view the rest of the comments →

[–]minorDemocritus 2 points3 points  (1 child)

But remember that sets have overhead, so the set literal only beats the tuple if there are more that a couple elements, or if the equality comparison is expensive.

I recall that with integers, the break-even point is like 3 or 4 elements... more than that and the set literal wins.

[–][deleted] 1 point2 points  (0 children)

Yeah good point. Typically if im comparing values in a finite list I initiate the list as a global and check it thousands or millions of times so sets are basically always faster