Functions vs OOP

Terry Reedy tjreedy at udel.edu
Sun Sep 4 20:32:07 CEST 2011


On 9/4/2011 4:13 AM, tinnews at isbd.co.uk wrote:
> Ian Kelly<ian.g.kelly at gmail.com>  wrote:

>> Functional programming is about using functions in the *mathematical*
>> sense.  A mathematical function maps one value (or tuple of values) to
>> another value.  The mapped value never varies; if it did, it would be
>> a different function.  So functional programming eschews the use of
>> functions where the results depend on any internal or external state
>> beyond the values of the passed-in arguments, such as the variable
>> state of the object the method is being called on.
>>
> I think there may be another issue here.  If someone says "functional
> programming" to me then I would generally assume that they *do* mean
> "programming using functions".  While your distinction of the two may
> be strictly correct I don't think it's the generally accepted meaning.

The distintion drawn by Ian *is* generally accepted in computer science. See
https://secure.wikimedia.org/wikipedia/en/wiki/Functional_programming
For instance, programming is C is imperative programming with functions 
but it generally is not 'functional programming' in the sense referred 
to by Ian and the Wikipedia article. Given that our docs are written by 
people who do understand the technical distinction, you are probably 
wrong to assume otherwise.

However, as I said to William, it is possible that our docs could be 
improved so as to not depend on all readers having prior knowledge of 
the intended meaning of 'functional programming'. As the use of Python 
has expanded, so has the variety of backgrounds of Python programmers.

-- 
Terry Jan Reedy




More information about the Python-list mailing list