Fun python 3.2 one-liner

gb gb at
Mon Apr 4 16:09:18 EDT 2011

harrismh777 <harrismh777 at> writes:

> Seriously, these little one liners teach me more about the python
> language in less time than [...]

def f(x,n,w): return x if n==1 else\
    (lambda x0=f(x[::2],n/2,w[::2]),\
            x1=f(x[1::2],n/2,w[::2]): reduce(lambda a,b: a+b ,\
                                             for k in range(n/2)])))()

it was a joke of sort played on it.comp.lang.python

[thanks to marco (zip(*...))  and antonio (lambda with default

More information about the Python-list mailing list