Securing a future for anonymous functions in Python

Skip Montanaro skip at
Thu Dec 30 20:35:43 CET 2004

    John> In other words, an anonymous function looks like:
    John>     {p1, p2, p3 |
    John>       stmt1
    John>       stmt2
    John>      }

    John> There are two reasons for using braces. One is that it's the
    John> common syntax for blocks in a large number of languages. 

Yeah, but it's not how blocks are spelled in Python.  As Nick pointed out on
his blog, allowing statements within expressions risks making code more
difficult to read and understand.

People keep trying to make Python something it is not.  It is not
fundamentally an expression-only language like Lisp, nor is it an
expression-equals-statement language like C.  There are good reasons why
Guido chose the relationship between simple statements, compound statements
and expressions that he did, readability and error avoidance being key.


More information about the Python-list mailing list