4 ms·
dedup = set(strings)
by bombela 5y ago
dedup = set(strings)
- quietbritishjim 5y agoThen what do you replace this line with? s = dedup.setdefault(s, s) There's not an obvious way to get the object in a set that matches a value you have.
- masklinn 5y agoWhile this works for dedup'ing a single set of strings, it doesn't work for dedup'ing string identities across the application lifetime because you don't have a fast way of fetching the deduplicated version from the base.