TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: What is the meaning of "Python’s broken notion of lambda"*?

1 pointsby mechnikalmost 14 years ago
* Hal Abelson in http://www.codequarterly.com/2011/hal-abelson/

3 comments

tmhedbergalmost 14 years ago
He may be referring to the fact that lambda expressions in Python are limited to a single statement. If you want anything more complex than that, you have to define a function elsewhere and pass it by name.
kwantamalmost 14 years ago
Two possible issues. As tmhedberg says (more or less), they're second-class citizens: they may contain one expression, and cannot contain any statements (e.g., 'print').<p>A more important issue: in LISP, ML, and other languages with a "proper" lambda, the value of a lambda expression is a lexical closure. Python's lambdas are dynamically scoped, which certainly qualifies as broken.<p>See, e.g., <a href="http://math.andrej.com/2009/04/09/pythons-lambda-is-broken/" rel="nofollow">http://math.andrej.com/2009/04/09/pythons-lambda-is-broken/</a>
mechnikalmost 14 years ago
Thank you for explaining this.