Hacker News new | ask | show | jobs
by BiteCode_dev 2207 days ago
It's hard to strike a balance for this.

For many FP programmers, the lambdas are not nearly magic enough.

In Swift, you can do something like this :

    reversedNames = names.sorted(by: { $0 > $1 } )
It's a closure expression, and is an anonymous block of code that will magically bind parameters passed to it to numbered variables.

So you see the position Python is in: it has to balance a bit of magic for the power user, and yet not too much for the casual user.

It's a very delicate exercice, and it receives a lot of critics for it.

An F# or Lisp dev comming to Python will complain that it's not expressive enough.

A geographer comming to Python will struggle reading advanced code.

Yet we have to catters to all of them, give the huge Python popularity and it's goal to be "the second best language for everything".

I think Guido did a very decent job at it, although he gets a lot of heat for it. People don't like to hear "no" when they ask for a poney.

And the lambda expression is one of the most controversial decisions. Beginners have a hard time with it, but professional coders may snap when they hear it's limited to one line.