Nov 18, 2021
I'm not sure I would call the first one an anti-pattern. Using Python lists certainly isn't an anti-pattern, and just because the `in` operator is faster for sets doesn't mean you should never use it for lists. If you are mainly doing membership tests of large amounts of data, and performance is important, you should consider using a set. But sets have significant limitations, for example they can only hold hashable elements, and no two elements can be the same.