combining several lambda equations
Antoon Pardon
apardon at forel.vub.ac.be
Mon Feb 21 06:47:24 EST 2005
Op 2005-02-18, Steven Bethard schreef <steven.bethard at gmail.com>:
> Paddy McCarthy wrote:
>> x=lambda : A < B
>> y=lambda : C+6 >= 7
>>
> [snip]
>>
>> Z=lambda : (A<B) and (C+6>=7)
>
> See "Inappropriate use of Lambda" in
> http://www.python.org/moin/DubiousPython
>
> Perhaps your real example is different, but notice that
> <name> = lambda <args>: <expr>
> is equivalent to
> def <name>(<args>):
> return <expr>
> except that the latter will give your function a useful name. No reason
> to use the *anonymous* function construct to create a *named* function.
So and if I have code like this:
f = lamda x:x
for g in some_iter:
f = compose(g,f)
Do you still think that one should use a named function in this case?
--
Antoon Pardon
More information about the Python-list
mailing list