Is Python a functional programming language?

Michele Simionato michele.simionato at gmail.com
Tue May 11 10:49:55 EDT 2010


On May 10, 8:18 pm, a... at pythoncraft.com (Aahz) wrote:
> saying that functional features
> are "tacked on" understates the case.  Consider how frequently people
> reach for list comps and gen exps.  Function dispatch through dicts is
> the standard replacement for a switch statement.  Lambda callbacks are
> common.  Etc, etc, etc

Just to play devil's advocate, I will notice that list comps and gen
exps are not really
functional (a generator has a state that changes at each call of
next). A functional language
would use streams instead. Function dispatch through dicts is very
lame compared to pattern matching. Lambdas are restricted. There is no
tail call optimization. Definitively Python functional features are
"tacked on" with respect to a language defined to be functional.
Having said that, the functional features are still usable and one can
use a functional style
in Python if she wants to (module a few caveats).



More information about the Python-list mailing list