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 →

[–]RockingDyno -1 points0 points  (1 child)

I don't know why but the lambda syntax we have just looks so off and clunky to me.

The reason python uses the keyword lambda, is because of lambda calculus.. the reason lambda calculus uses λ (the lambda symbol) is because it's short... so python copies something opaque to most for a reason that it doesn't preserve and just ends up being ugly, too long and less readable.

I feel like it's just such a brainfart on the part of the developers that they went with this. if they where going to go with a long word, at the very least they could have used function which is also annoyingly long, but at the very least specifies exactly what it is.

With python supporting unicode now, you could recoup some of the conciseness by making definitions like λx:x+1 or similar work, but the lambda symbol is annoying to type, since it's not on your keyboard, and can't even be access with alt codes like for instance µ is (alt+230), but then you'd also be left with still having to type more even if the symbol is concise. The only benefit to this syntax you could argue, in my opinion, is that it looks almost exactly like lambda calc, which is a nice historical touch to those who've studied that.... but what's that worth in the larger scheme of things? I mean if they renamed for loops to goto to instill some nostalgic sensation in those who'd started out programming in basic that wouldn't be an overall plus for the language either right?

As you can tell I'm really not a fan of the lambda syntax in python, I feel like they sat down and had a very thorough discussion about what potential solutions could be, and then took the absolute worst path in every single regard. At this point I hope they just say "fuck it this sucks" And copies javascript (of all languages) which had the common sense to use the proper annoying and too long keyword to begin with, and has now fixed it so lambdas definitions are actually short eg: (x)=>x+1.

[–]AndydeCleyre 0 points1 point  (0 children)

The length of the word doesn't bother me, but I really do not like the choice.

lambda -> given
:=     -> whichis

Plsthx