Document options
Document options requiring JavaScript are not displayed
Rate this pageHelp us improve this contentLevel: IntroductoryDavid Mertz (mertz@gnosis.cx), Applied Metaphysician, Gnosis Software, Inc. 01 Mar 2001Although users usually think of Python as a procedural and object-oriented language, it actually contains everything you need for a completely functional approach to programming. This article discusses general concepts of functional programming, and illustrates ways of implementing functional techniques in Python. We'd better start with the hardest question: "What is functional
programming (FP), anyway?" One answer would be to say that
FP is what you do when you program in languages like Lisp,
Scheme, Haskell, ML, OCAML, Clean, Mercury, or Erlang (or a few
others). That is a safe answer, but not one that clarifies
very much. Unfortunately, it is hard to get a consistent
opinion on just what FP is, even from functional programmers
themselves. A story about elephants and blind men seems
apropos here. It is also safe to contrast FP with "imperative
programming" (what you do in languages like C, Pascal, C++,
Java, Perl, Awk, TCL, and most others, at least for the most
part).