[Python-ideas] One more time... lambda function <--- from *** signature def.

Chris Angelico rosuav at gmail.com
Sat Mar 1 03:17:10 CET 2014


On Sat, Mar 1, 2014 at 1:13 PM, Ron Adam <ron3200 at gmail.com> wrote:
> Somehow I was thinking this morning the code inside the function call
> parentheses f(...), could be parsed later than it actually is.  And in the
> context of the function definition, possibly similar to how a comprehension
> is evaluated.  But it would take

The best way to do it would be to adorn the call site. We can
currently do that with lambda:

f(a * b + c)
f(lambda: a * b + c)

Those are completely different from each other, but completely
consistent with themselves - it doesn't matter what f is, one of them
passes the sum of the product and the other passes a callable.

ChrisA


More information about the Python-ideas mailing list