Is Python a functional programming language?

Paul Rubin no.email at nospam.invalid
Tue May 11 10:36:30 EDT 2010


Lawrence D'Oliveiro <ldo at geek-central.gen.new_zealand> writes:
> I thought the opposite of “functional” was “procedural”, not “imperative”. 
> The opposite to the latter is “declarative”. But (nearly) all procedural 
> languages also have declarative constructs, not just imperative ones 
> (certainly Python does). Presumably an “imperative” language would not.

Offhand I can't tell that imperative and procedural mean something
different.  Both basically mean that the programmer specifies a series
of steps for the computer to carry out.  Functional languages are mostly
declarative; for example, an expression like
   x = 3
is called an "equation" rather than an "assignment".  It declares "x is
equal to 3", rather than directing x to be set to 3.  If someplace else
in the program you say "x = 4", that is an error, normally caught by
the compiler, since x cannot be equal to both 3 and 4.



More information about the Python-list mailing list