what's wrong with "lambda x : print x/60,x%60"

Antoon Pardon apardon at forel.vub.ac.be
Tue Dec 6 09:30:59 CET 2005


Op 2005-12-06, bonono at gmail.com schreef <bonono at gmail.com>:
>
> Paul Rubin wrote:
>> > Why use temporary variables when all you have to do is make your
>> > expressions three lines long to avoid "polluting the namespace"?
>>
>> Indeed.  I'd much rather say
>>
>>   x = a + b + (c * d) + e
>>
>> than
>>
>>   temp1 = a + b
>>   temp2 = c * d
>>   temp3 = temp1 + temp2
>>   x = temp3 + e
>>
>> I don't understand why the critics of lambda don't understand that
>> having to use so many temp variables, for either numbers or functions,
>> can work against both concision and clarity.
>
> For some people, the second form is clearer.

But there is no suggestion that this should be the obligatory form.

-- 
Antoon Pardon



More information about the Python-list mailing list