[issue13095] Support for splitting lists/tuples into chunks

Cal Leeming report at bugs.python.org
Mon Oct 3 20:56:33 CEST 2011


Cal Leeming <cal.leeming at simplicitymedialtd.co.uk> added the comment:

Oh - and while we are at it - how about having merge_list() and unique_list() as part of the core too??


def unique_list(seq): # Dave Kirby
    # Order preserving
    seen = set()
    return [x for x in seq if x not in seen and not seen.add(x)]
    
def merge_list(seq):
    merged = []
    for s in seq:
        for x in s:
            merged.append(x)
    return merged

Raymond - any thoughts on these 3 requests???

Cal

----------

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


More information about the Python-bugs-list mailing list