args (was Re: Lambda as declarative idiom (was RE: what is lambda used for in real code?))
rnd at onego.ru
Tue Jan 4 23:42:40 CET 2005
On Tue, 4 Jan 2005, Michael Spencer wrote:
>Roman Suzi wrote:
>> Maybe this is too outlandish, but I see lambdas as a "quote" mechanism,
>> which presents a possibility to postpone (precisely control, delegate)
>> evaluation. That is, an ovehead for lambda must be much lower but at the
>> same time visible to the programmer:
>> d = a + (lambda x, y: x+ y)(3, 4)
>I believe that this "possibility to postpone" divides into two related but
>separate concepts: controlling the moment of evaluation, and assembling the
>arguments required at that moment.
Yes. I have the same understanding.
>They are both species of 'eval', but
>managing arguments is more specialized, because it includes possibly renaming
>parameters, assigning default values, processing positional and keyword
>arguments, and, perhaps in the future dealing with argument types.
>Meanwhile, GvR wrote (about defining Interfaces in the context of Optional
>Static Type Checking)
As for GvR's writing, I think he is exploring the ground. What he wrote
is too complex for Python and he guesses it is.
There i another thread in c.l.p where I propose generic programming
approach for Python's "type checking": IMHO, a much simpler and more natural
for Python than programming by contract, just interfaces and such.
And the syntactic way to express concepts is going thru
declarations. That is why lambdas are to be on steroids for this task.
More than that, compile vs. evaluation/parameter dispetching must not muddy
the waters for programmer. It must always be clear (syntactically too)
for him what is going on in the expression at hand. (But I do not know
how this could be elegantly done sytactically)
Is declaration-chewing engine built into Python an overkill?
There are at least 2 specialized ones in it: parser and re.compile +
many for different formats, like xml.dom.
Sincerely yours, Roman Suzi
rnd at onego.ru =\= My AI powered by GNU/Linux RedHat 7.3
More information about the Python-list