42 ms·
Python's lambda was pretty sad last I looked. Has it caught up with Lisp/Clojure's? And has the BDFL stopped trying to eliminate it altogether? I heard he regre
by kennytilton 8y ago
Python's lambda was pretty sad last I looked. Has it caught up with Lisp/Clojure's? And has the BDFL stopped trying to eliminate it altogether? I heard he regretted adding it and wanted to yank it at some point. The D in BDFL looks a lot bigger than the B.
- fulafel 8y agoPython's lambda is unchanged, and it is still included. I have the impression that Guido regrets adding it because of the language-design-aesthetic wart - the recurring "why is it called lambda when it can only define single-expression functions?" "you can just use def in the scope just before use, if you need statements" "but then it's not anonymous!" "just use a temp name" dialog loop.
- kennytilton 8y agoYou know, I completely misapprehended your original query. No, it is fine that GvR called it "lambda". Had he called it experfn we would all translate mentally to "lambda" anyway. I am just sorry Mr. Norvig considers it equivalent to Lisp's, or does not consider it essential to Lispy-ness.
- deleted 8y ago[deleted]
- kazinator 8y agoThe situation is worse: Python doesn't support let. It's so bad that the Hy people aren't able to support let in their Lisp-skin-over-Python. Python's handling of local variables, whereby assignment and binding are conflated, is perpetrating a harm to the education of neophytes. It also means that "x = 42" can never be an "assignment to undefined variable x" error in Python, even when in fact it is that error: the programmer thinks there is an existing x being modified, but there isn't. Or more likely, the programmer thinks that an existing y is being modified which does exist, but made a typo and wrote x instead.