[Python-ideas] data structures should have an .any() method

Masklinn masklinn at masklinn.net
Sat Sep 5 16:15:47 CEST 2009


On 5 Sep 2009, at 15:47 , Gerald Britton wrote:
Ah -- so not a real function then (yet)?  Though something we could
> borrow from Haskell, I suppose, even though:
>
> compose(foo,bar) == lambda x: foo(bar(x))
>
> no?
>

Yeah but you could leverage Python's *args to get a compositor of more  
than two functions e.g.

    def compose(*funcs):
        return reduce(lambda f1, f2:
                          lambda *args, **kwargs:
                              f1(f2(*args, **kwargs)),
                      funcs)



More information about the Python-ideas mailing list