Why Python's Lambda is Broken and Can't be Fixed

, , …,

You have to contend with Python's broken notion of lambda but other than that it's not really that different [from teaching computer science using Scheme Lisp].

From 〔Hal Abelson Q&A By Peter Seibel. @ http://www.codequarterly.com/2011/hal-abelson/

Structure and Interpretation of Computer Programs
Cover of 〈Structure and Interpretation of Computer Programs〉 amazon

Python's broken lambda… Indeed.

Why Python's Lambda is Broken and Can't be Fixed

Here's why Python's lambda is broken and can't be fixed.

Syntactically, lambda is a way to define a function, which may be arbitrarily complex. But due to Python syntax choice of indentation, so full lambda will need indentation, and thus cannot be a inline argument to other functions.

The other issue is that Guido doesn't like functional programing.

So, what we have here is a syntax-induced limitation on the language's semantics.

The take-away of this is that, syntax is fundamental in programing languages. And, syntax is the MOST important part of language. It influences thought and what sort of program comes out.

Lisp wouldn't have developed its macros if its syntax isn't mostly regularly nested parens. XML wouldn't have developed many of its processing tools and tree-walkers if its syntax isn't nested tree. You wouldn't chain commands if unix shell doesn't have the pipe syntax.