[Python-ideas] Implicit lambda Re: Reducing colon uses to increase readability

Roman Susi rnd at onego.ru
Thu Jul 3 14:06:40 CEST 2008


Arnaud Delobelle wrote:
> 
> On 30 Jun 2008, at 02:41, Andre Roberge wrote:


>> lambda assignments
>> ---------------------------
>>
>> Once again, same choice.
>>
>> lambda x -> x+1
>> is, I think, more readable than
>> lambda x: x+1
>>
>> (but perhaps the last two [dicts and lambda] largely depends on the
>> font choice...)
> 
> You could even drop the 'lambda' and simply write:
> 
> x -> x+1
> 
> This would please those who advocate the removal of lambda from the
> language ;)
> 

While I'd hate -> or <- being used in Python syntax (regardless where)
(I think, := for assignment might be less evil).

However, changing the topic, the idea of dropping lambda in some cases
was already raised:

http://www.python.org/dev/peps/pep-0312/

(still deferred).

The implicit lambda is then more like a quote in Lisp, roughly: "things
which aren't yet evaluated".

I understood that the PEP312 was perceived as a partial case for the
inline if-then-else and soon forgotten (when inline if made it into Python).

Maybe its time to look at those lambdas again to see if there is some
value in the lambdas without the word lambda? (N.B. The things has been
already discussed couple of times and even backed by some Python
developers:
http://mail.python.org/pipermail/python-dev/2005-June/054303.html

and even some later discussions occured:

http://osdir.com/ml/python.python-3000.devel/2006-05/msg00773.html

The main idea of implicit lambda is to better support lazy evaluations.
However, beyond obvious simple cases omitting lambda makes code less
readable.


Regards,
Roman



More information about the Python-ideas mailing list