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

Bruce Leban bruce at leapyear.org
Tue Mar 4 08:26:13 CET 2014


On Mar 3, 2014, at 22:02, David Townshend <aquavitae69 at gmail.com> wrote:
>
> What about a new code literal object, e.g.
>
>     thunk = c'x + 3'
>     thunk(x=2)
>
> This already exists.

    thunk = lambda: x + 3
    thunk(x=2)

Your original post in this thread wanted to allow functions to magically
capture their parameters as code (~ call by name) and it's been pointed out
that that is incompatible with the way the language is designed and
function calls are implemented. Yes, there are languages where the called
function gets to tell the caller how to package arguments but Python isn't
one of them.

Now you seem to have veered in a different direction. I have no idea what
problem you are trying to solve.

--- Bruce
Learn how hackers think: http://j.mp/gruyere-security
https://www.linkedin.com/in/bruceleban
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140303/98627761/attachment.html>


More information about the Python-ideas mailing list