Use Sets to Improve Python Performance
Published in
3 min readOct 16, 2022
One of the first concepts I’ve learned in Python were lists and iterating over them. Lists are undoubtedly a very important concept, but I often find myself over-relying on them, especially in the case of membership tests (checking if one element from one list is in another), which can negatively impact performance runtime. Depending on the situation, different datatypes, such as sets, may be a more optimal solution.