On Mon, 4 Jul 2005, George Sakkis wrote: > "Tom Anderson" <[EMAIL PROTECTED]> wrote: > >> I'll just chip in and say i'd quite like a flatten(), too; at the moment, >> i have one like this: >> >> def flatten(ll): >> return reduce(lambda a, l: a.extend(l), ll, []) > > This doesn't work; a.extend() returns None, not the extended list a:
Ah, no, very good, i was hoping someone would notice that. Well done. I think my lambda looks more like lambda a, b: a + b, but i realised the other day that extend could make it more efficient, and didn't think it through properly. tom -- The revolution will not be televised. The revolution will be live. -- http://mail.python.org/mailman/listinfo/python-list