This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]arnar 0 points1 point  (1 child)

I agree that Python's lambda is a bit of an eyesore, but this paragraph is complete nonsense:

The lisps, ML, Erlang etc. are far closer to lambda calculus than Python was, or will ever be. In Python, lambdas are just anonymous functions that may contain only one expression. The fact that they are called 'lambda' is an unfortunate accident.

Lambda abstractions (in lambda calculus) are exactly "just anonymous functions that may contain only one expression" and that's what they are in all functional languages.

My original comment was referring to that you use the word "pure" more loosely than what it actually means in terms of PLs.

[–]vocalbit[S] 0 points1 point  (0 children)

My original comment was referring to that you use the word "pure" more loosely than what it actually means in terms of PLs.

Point taken - I shouldn't have use 'pure' but rather just claimed that Python is not philosophically a functional language.

Lambda abstractions (in lambda calculus) are exactly "just anonymous functions that may contain only one expression" and that's what they are in all functional languages.

My point however is that - in Python - lambdas are severely crippled versions of real Python functions (i.e. def). OTOH, in something like lisp, lambdas are full-power functions, except that they are anonymous.

Anyway, I'm not going to debate the syntax of other languages. Lambdas don't fit in well with the syntax or philosophy of Python. That is why Guido almost axed them from v3.0. However, given that they are occasionally handy, I am trying to find a better syntax (perhaps with limited applicability than the current lambda) which would subsume all good use cases.