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

Carl Johnson cmjohnson.mailinglist at gmail.com
Thu Jul 16 21:48:30 CEST 2009


Chris Perkins wrote:

> Which is an error. However:
>    x = foo(y) where:
>        y = []
>        for i in range(n):
>            if cond(i):
>                break
>            y.append(i)
> must be allowed (right?). So we can't make a blanket restriction on
> break/continue within the body.

Same with return and yield if there's a def inside the where. (Seems
obvious, but you never mentioned it.)

-- Carl Johnson



More information about the Python-ideas mailing list