Comment

Comment by hprotagonist

sets are great. A slightly janky but very tidy way to know if a list of (hashable) things has any duplicates in python is to test

  len(set(mylist)) == len(mylist) 
which probably loses on big O to some more clever approaches but is just fine for small n, and very readable.

Other trivially answerable questions include “what’s in me but not in this other collection”, “what’s in both of us”, “what’s in exactly one of us”, ... etc.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton