def removeDuplicates(seq, idfun=None):
<EOL>if idfun is None:<EOL><INDENT>def idfun(x): return x<EOL><DEDENT>seen = {}<EOL>result = []<EOL>for item in seq:<EOL><INDENT>marker = idfun(item)<EOL>if marker in seen:<EOL><INDENT>continue<EOL><DEDENT>seen[marker] = <NUM_LIT:1><EOL>result.append(item)<EOL><DEDENT>return result<EOL>
removal all duplicates from a list, preserving the order:

>>> a=list('ABeeECcc')
>>> removeDuplicates(a)
['A', 'B', 'e', 'E', 'C', 'c']

>>> removeDuplicates(a, lambda x: x.lower())
['A', 'B', 'e', 'C']