On 01/04/2016 01:30 PM, Mike Frysinger wrote: > + # Filter out > duplicates. We do this by hand (rather > + # than use a > set) so the order is stable and better > + # matches the > order that's in the ebuild itself. > + atoms = [] > + for atom in > all_atoms: > + if atom > not in atoms: > + > atoms.append(atom) > +
Alternative implementation using OrderedDict which has O(1) average complexity for containment checks, rather than O(N): atoms = OrderedDict() for atom in all_atoms: atoms.setdefault(atom, atom) atoms = list(atoms) -- Thanks, Zac