⬅︎ Back to Fastest way to uniqify a list in Python
why not? def f5(self, seq, idfun=lambda x : x):and remove: if idfun is None: def idfun(x): return x
Because that makes it possible to optionally override what the key should be. Some items aren't hashable. E.g. dicts.
Peter - nasgar's merely replacing your identity function plug with an inline lambda in the function def. I think that is valid to do (achieves the same thing), but does look harder to read.
Comment
why not?
def f5(self, seq, idfun=lambda x : x):
and remove:
if idfun is None:
def idfun(x): return x
Replies
Because that makes it possible to optionally override what the key should be. Some items aren't hashable. E.g. dicts.
Peter - nasgar's merely replacing your identity function plug with an inline lambda in the function def. I think that is valid to do (achieves the same thing), but does look harder to read.