In "Masterminds of Programming", Guido van Rossum states:
Python probably has the reputation of supporting functional programming based on the inclusion oflambda
,map
,filter
andreduce
in the language, but in my eyes these are just syntactic sugar, and not the fundamental building blocks that they are in functional languages. The more fundamental property that Python shares with Lisp (not a functional language either!) is that functions are first-class objects, and can be passed around like any other object. This, combined with nested scopes and a generally Lisp-like approach to function state, makes it possible to easily implement concepts that superficially resemble concepts from functional languages, like currying, map, and reduce. The primitive operators that are necessary to implement those concepts are built into Python, where in functional languages, those concepts are the primitive operations. You can writereduce()
in a few lines of Python. Not so in a functional language.
(Bold emphasis mine)
Uhh...