[Python-Dev] anonymous blocks

Ka-Ping Yee python-dev at zesty.ca
Fri Apr 22 02:39:18 CEST 2005


On Thu, 21 Apr 2005, Guido van Rossum wrote:
> The use cases where the block actually returns a value are probably
> callbacks for things like sort() or map(); I have to admit that I'd
> rather keep lambda for these (and use named functions for longer
> blocks) than introduce an anonymous block syntax that can return
> values!

It seems to me that, in general, Python likes to use keywords for
statements and operators for expressions.

Maybe the reason lambda looks like such a wart is that it uses a
keyword in the middle of an expression.  It also uses the colon
*not* to introduce an indented suite, which is a strange thing to
the Pythonic eye.  This suggests that an operator might fit better.

A possible operator for lambda might be ->.

    sort(items, key=x -> x.lower())

Anyway, just a thought.


-- ?!ng


More information about the Python-Dev mailing list