flatten a level one list

David Murmann david.murmann at rwth-aachen.de
Thu Jan 12 09:03:39 EST 2006

Robin Becker schrieb:
> # New attempts:
> from itertools import imap
> def flatten4(x, y):
>     '''D Murman'''
>     l = []
>     list(imap(l.extend, izip(x, y)))
>     return l
> from Tkinter import _flatten
> def flatten5(x, y):
>     '''D Murman'''
>     return list(_flatten(zip(x, y)))

well, i would really like to take credit for these, but they're
not mine ;) (credit goes to Michael Spencer). i especially like
flatten4, even if its not as fast as the phenomenally faster

David Murmann (NN!) ;)

More information about the Python-list mailing list