erikrose/more-itertools — pull request #19 by abarnert (2012-11-17 00:34:37+00:00)
Title: Modify unique_everseen to handle non-hashable elements.

- Try the set-based algorithm, but fall back to a list on a TypeError.

- This is less than 5% slower when everything is hashable, up to 10x slower
(but still competitive with other non-hashing algorithms) in the worst case
(all elements are non-hashable).

I'm not sure whether you want this, at least under this name, for two reasons.

First, although it's a drop-in replacement for the itertools docs recipe of the same name, it's not identical to it.

Second, it is almost 5% slower when everything is hashable—plus, there might conceivably be cases where being hashable is part of your preconditions, and you'd rather get an exception than have things silently work and take longer.

However, I think for general-purpose use, this is a big improvement.

See the thread that starts http://mail.python.org/pipermail/python-ideas/2012-November/017881.html for more details.