On 16.02.2021 23:13, Greg Ewing wrote:
On 17/02/21 7:10 am, Steven D'Aprano wrote:
"It's Greek letter, like pi that you may remember from maths class. In some technical computer science, the Greek L, lambda, is used as the symbol for functions."
The most accurate answer seems to be "Because somebody made a mistake transcribing a mathematics paper many years ago." :-)
The Python notation for anonymous function is almost a direct reference to the original notation for such functions in lambda calculus: λx.x+1 ... lambda x: x+1 I think that's an excellent hint for students to look up on this great piece of mathematical logic: https://en.wikipedia.org/wiki/Lambda_calculus and learn something about the foundations of computer science. Why the Greek letter lambda ? Who knows -- mathematicians love Greek letters, logic is λογική in Greek, ... https://en.wikipedia.org/wiki/Lambda_calculus#Origin_of_the_lambda_symbol And, of course, if you don't like anonymous functions, you're always free to give your functions names in Python ;-) -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, Feb 17 2021)
Python Projects, Coaching and Support ... https://www.egenix.com/ Python Product Development ... https://consulting.egenix.com/
::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 https://www.egenix.com/company/contact/ https://www.malemburg.com/