On PEP 312: simple implicit lambda
Manuel M. Garcia
mail at manuelmgarcia.com
Sun Feb 16 13:51:28 EST 2003
On Sun, 16 Feb 2003 16:47:11 +0200, Christos "TZOTZIOY" Georgiou
<DLNXPEGFQVEB at spammotel.com> wrote:
(edit)
>A little far-fetched, so please bear with me.
>
>I would suggest that 'lambda-less lambdas' become code snippets instead
>of actual functions... by code snippets, I mean something like
>subroutines in the old BASIC way. The reason for this is only
>performance: avoiding a function call. Read the seemingly off-topic
>post and at the end I will make the connection to implicit lambdas.
I forgot to mention that on Python-Dev there is some talk about adding
the ability to manipulate blocks of code, to allow extensions to the
language that are written in Python. Beyond 'lambda-less lambdas', it
would also allow the creation of new looping and control statements!
It would introduce a new kind of object in Python, called a 'thunk'.
A 'thunk' would be a block of Python code packaged inside of an
object. The 'thunk' could then be programmatically manipulated and
its execution controlled.
I believe Guido is a little envious of Ruby's ability to do stuff like
this...
>From: guido at python.org (Guido van Rossum)
>Date: Fri, 31 Jan 2003 13:45:21 -0500
>Subject: question??? [Python-Dev] Property syntax
>
>> From: "Guido van Rossum" <guido at python.org>
>> >
>> > So the compiler cannot look at what the thunk is used for. We need
>> > uniform treatment of all thunks. (Even if it means that the thunk's
>> > consumer has to work a little harder.)
>>
>> is it a correct assumption that generalized thunks be it, and so
>> argumenting against them is wasting my time?
>
>Not at all. This is still wide open. I happen to like generalized
>thunks because they remind me of Ruby blocks. But I realize there are
>more ways to skin this cat. Keep it coming!
>
>And remember, I'm arguing in my spare time. :-)
>
>--Guido van Rossum (home page: http://www.python.org/~guido/)
The discussion went over my head very early on. Unfortunately, the
discussion lost some steam because of the evil influence of the
'if-then-else-expression' controversy. There is currently no good
summary of all the 'thunks' ideas suggested.
The discussion of 'thunks' is very blue sky. 'Thunks' are much more
disruptive than adding a 'if-then-else-expression'! Doubtful we will
ever see them, and if we do see them, it will not be soon.
Manuel
More information about the Python-list
mailing list