Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #12749

Re: Functions vs OOP

From William Gill <nospam@domain.invalid>
Newsgroups comp.lang.python
Subject Re: Functions vs OOP
Date 2011-09-04 15:43 -0400
Organization A noiseless patient Spider
Message-ID <j40kd8$du4$1@dont-email.me> (permalink)
References <j3tjov$c30$1@dont-email.me> <mailman.743.1315075846.27778.python-list@python.org> <tiobj8-sng.ln1@chris.zbmc.eu> <mailman.761.1315161191.27778.python-list@python.org>

Show all headers | View raw


On 9/4/2011 2:32 PM, Terry Reedy wrote:
> On 9/4/2011 4:13 AM, tinnews@isbd.co.uk wrote:
>> Ian Kelly<ian.g.kelly@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.
>
Since I am the one who opened this can of worms, and since I believe I 
have relocated the document that I misinterpreted,  I feel compelled to 
jump in here.

The source of my error is "Functional Programming HOWTO 
(/python-3.1.3-docs-html/howto/functional.html)"

Having arrived at this page indirectly (searching for and skimming other 
information regarding functions and methods) I was only half paying 
attention.  As a result I made the same mistake Chris did.

As a point of reference, I would not call myself a programmer, and any 
formal exposure was many, many years ago.  I am familiar with the 
concepts of procedural, declarative, and object-oriented programming, 
but not functional.  At least not in this context.

Having done a little more digging I now understand the difference. 
"Functional programming" is the proper terminology, and had I come 
across it from another direction, or with a more deliberate focus I 
probably wouldn't have made the initial mistake.

If you read the material with even a nominal understanding of the 
functional paradigm (functional relationships in a mathematical sense, 
not functions in the procedural sense), it is clear.  If you read it 
without consciously recognizing this difference, the material does 
nothing to alert you to the initial error.



Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Functions vs OOP William Gill <noreply@domain.invalid> - 2011-09-03 12:15 -0400
  Re: Functions vs OOP Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-09-04 02:25 +1000
    Re: Functions vs OOP Terry Reedy <tjreedy@udel.edu> - 2011-09-03 15:15 -0400
      Re: Functions vs OOP William Gill <noreply@domain.invalid> - 2011-09-03 17:34 -0400
        Re: Functions vs OOP Ben Finney <ben+python@benfinney.id.au> - 2011-09-04 07:39 +1000
          Re: Functions vs OOP William Gill <nospam@domain.invalid> - 2011-09-03 17:58 -0400
        Re: Functions vs OOP Terry Reedy <tjreedy@udel.edu> - 2011-09-03 21:51 -0400
          Re: Functions vs OOP William Gill <noreply@domain.invalid> - 2011-09-03 22:18 -0400
    Re: Functions vs OOP William Gill <nospam@domain.invalid> - 2011-09-05 14:58 -0400
  Re: Functions vs OOP MRAB <python@mrabarnett.plus.com> - 2011-09-03 17:29 +0100
    Re: Functions vs OOP William Gill <noreply@domain.invalid> - 2011-09-03 17:09 -0400
  Re: Functions vs OOP Ian Kelly <ian.g.kelly@gmail.com> - 2011-09-03 12:50 -0600
    Re: Functions vs OOP William Gill <noreply@domain.invalid> - 2011-09-03 17:13 -0400
    Re: Functions vs OOP tinnews@isbd.co.uk - 2011-09-04 09:13 +0100
      Re: Functions vs OOP Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-09-04 21:18 +1000
      Re: Functions vs OOP Terry Reedy <tjreedy@udel.edu> - 2011-09-04 14:32 -0400
        Re: Functions vs OOP William Gill <nospam@domain.invalid> - 2011-09-04 15:43 -0400
          Re: Functions vs OOP Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-09-05 09:41 +1000
            Re: Functions vs OOP William Gill <nospam@domain.invalid> - 2011-09-04 20:46 -0400
            Re: Functions vs OOP Chris Angelico <rosuav@gmail.com> - 2011-09-05 10:59 +1000
  Re: Functions vs OOP rusi <rustompmody@gmail.com> - 2011-09-04 06:13 -0700
    Re: Functions vs OOP William Gill <noreply@domain.invalid> - 2011-09-05 13:45 -0400
      Re: Functions vs OOP Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-09-05 21:04 +0200
        Re: Functions vs OOP William Gill <nospam@domain.invalid> - 2011-09-05 20:30 -0400
      Re: Functions vs OOP Terry Reedy <tjreedy@udel.edu> - 2011-09-05 18:55 -0400

csiph-web