[New-bugs-announce] [issue4615] de-duping function in itertools

Tom Pinckney report at bugs.python.org
Wed Dec 10 03:47:59 CET 2008


New submission from Tom Pinckney <thomaspinckney3 at gmail.com>:

Any interest in an itertools de-duping function? I find I have to write 
this over and over for different projects:

def deduped(iter,key=None):
    keys = set()
    for x in iter:
        if key:
            k = key(x)
        else:
            k = x
        if k in keys:
            continue
        keys.add(k)
        yield(x)

----------
components: Library (Lib)
messages: 77477
nosy: thomaspinckney3
severity: normal
status: open
title: de-duping function in itertools
type: feature request
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4615>
_______________________________________


More information about the New-bugs-announce mailing list