[Python-ideas] Where-statement (Proposal for function expressions)

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Jul 16 09:28:20 CEST 2009


Carl Johnson wrote:

> Surely, you meant
> 
> foo(f, g) where:
>    def f(x):
>      ...
>    def g(y):
>      ...

Yes, that's what I meant.

> new_list = [fx for f in fs if fx] where:
>     fx = f(x)

No, there would have to be a separate, analogous
extension to list comprehensions:

   new_list = [fx for f in fs if fx where fx = f(x)]

or maybe

   new_list = [fx where fx = f(x) for f in fs if fx]

-- 
Greg



More information about the Python-ideas mailing list