The natural way in Python to write an anonymous function would be to simply drop the name in a regular function definition:
def (a): return a**2 The lambda notation is less verbose and closer to computer science theory, though: lambda a: a**2 FWIW: I don't understand why people are so unhappy with lambdas. There isn't all that much use for lambdas in Python anyway. Most of the time, a named function will result in more readable code. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, Feb 23 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/ _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/33MWG4DQOW5ALFJJVI6VYFJUWQ6LV3JQ/ Code of Conduct: http://python.org/psf/codeofconduct/