[Python-Dev] return statements in lambda

Fredrik Lundh Fredrik Lundh" <effbot@telia.com
Sun, 5 Mar 2000 10:24:37 +0100


from "Python for Lisp Programmers":
http://www.norvig.com/python-lisp.html

> Don't forget return. Writing def twice(x): x+x is tempting
> and doesn't signal a warning or > ception, but you probably
> meant to have a return in there. This is particularly irksome
> because in a lambda you are prohibited from writing return,
> but the semantics is to do the return.=20

maybe adding an (optional but encouraged) "return"
to lambda would be an improvement?

    lambda x: x + 10

vs.

    lambda x: return x + 10

or is this just more confusing...  opinions?

</F>