Python Functional Programming – Is Lambda Still Supported?

functional programminglambdapython

Only one or two years ago, I remember reading Python constructs that would be removed from Python — reduce was one of them — and other constructs that would be emphasized like comprehensions and generators. I saw a very nice description of how Python could be made more functional here, and I was wondering on which list lambda appeared, supported or soon-not-to-be supported.

Best Answer

lambda is not deprecated, and will continue to be part of the language. Attempts have been made to find an alternative, but nothing fruitful ever came from that.

Quoting a post by Guido van Rossum in 2006:

After so many attempts to come up with an alternative for lambda, perhaps we should admit defeat. I've not had the time to follow the most recent rounds, but I propose that we keep lambda, so as to stop wasting everybody's talent and time on an impossible quest.

reduce() was moved to the functools module, so out of the built-in namespace, because its use in Python has always remained obscure. map() is still there though, as it was shown to be very useful still.

Related Topic