Went looking for an intersection/difference function for lists and stumbled on the set built-in. Like I knew set was there, but never understood why to use it.

sets contain unique elements and faster membership testing. Plus the aforementioned set functions that are not part of lists.

I started thinking about a sequence of code where I was conditionally adding things to a list to avoid duplicates. So I went and simplified it by using sets. And the code is more readable because of it. A nice TIL for something I was kind of aware of but not aware of why it was there.

#python