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


Groups > comp.lang.python > #12795

Re: Functions vs OOP

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python,': 0.01; 'function,': 0.07; 'received:verizon.net': 0.07; 'semantic': 0.07; 'terry': 0.07; 'python': 0.08; '(also': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'am,': 0.12; 'library': 0.15; '9:13': 0.16; '9:15': 0.16; 'default).': 0.16; 'fp:': 0.16; 'reedy': 0.16; 'semantically': 0.16; 'side-effects': 0.16; 'subject:OOP': 0.16; 'syntactic': 0.16; 'syntactical': 0.16; 'wrote:': 0.16; '>>>': 0.18; 'functions,': 0.18; 'jan': 0.19; 'programming': 0.20; 'math': 0.21; 'header:In-Reply-To:1': 0.22; '(or': 0.23; 'sep': 0.23; 'somehow': 0.23; 'suggests': 0.23; 'pm,': 0.24; 'suggestion': 0.26; '(in': 0.26; 'function': 0.27; 'separate': 0.28; 'depends': 0.28; 'problem': 0.28; 'not.': 0.30; 'functional': 0.31; 'objects': 0.32; 'does': 0.32; 'usually': 0.32; 'source': 0.33; 'sort': 0.33; 'to:addr:python-list': 0.33; 'header:User-Agent:1': 0.34; 'requirements': 0.34; 'staying': 0.34; 'header:X-Complaints-To:1': 0.35; 'uses': 0.35; '(for': 0.35; 'object': 0.35; 'problems': 0.36; 'skip:" 10': 0.36; 'none': 0.37; 'depend': 0.37; 'languages': 0.37; 'using': 0.37; 'but': 0.37; 'could': 0.38; 'received:org': 0.38; 'returning': 0.38; 'somewhat': 0.38; 'some': 0.38; 'subject:: ': 0.39; 'header:Mime- Version:1': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'procedures': 0.64; 'believe': 0.65; 'procedure.': 0.67; 'william': 0.68; 'wish': 0.69; 'research,': 0.82; 'distinguish': 0.84; 'moment)': 0.84; 'rusi': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: Functions vs OOP
Date Mon, 05 Sep 2011 18:55:36 -0400
References <j3tjov$c30$1@dont-email.me> <d6c071ac-2def-44a1-baa5-a545d2988def@a10g2000prn.googlegroups.com> <j431q1$rrl$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-74-109-121-73.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20110812 Thunderbird/6.0
In-Reply-To <j431q1$rrl$1@dont-email.me>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.783.1315263399.27778.python-list@python.org> (permalink)
Lines 46
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1315263399 news.xs4all.nl 2529 [2001:888:2000:d::a6]:57209
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:12795

Show key headers only | View raw


On 9/5/2011 1:45 PM, William Gill wrote:
> On 9/4/2011 9:13 AM, rusi wrote:
>> On Sep 3, 9:15 pm, William Gill<nore...@domain.invalid> wrote:
>>> During some recent research, and re-familiarization with Python, I came
>>> across documentation that suggests that programming using functions, and
>>> programming using objects were somehow opposing techniques.
>>
>> Staying with (for the moment) the suggestion that OO-P and F-P are
>> complementary, I believe it is worthwhile to distinguish syntactic OO-
>> P vs F-P from semantic OO-P vs F-P.
>>
>> Syntactically: f(x) is functional x.f() is object oriented.
>> Semantically if f's return value depends only on x ie does not depend
>> on state it is functional (in the math sense) -- the jargon is that f
>> is referentially transparent.
>
> Not to split hairs, but syntactically f(x) is a function in many
> programming paradigms.
>
> As I understand it functional programming places specific requirements
> on functions, i.e.referential transparency. So f(x) may or may not be
> "functional".

In Python, it may be a parameterized procedure. Some languages separate 
functions and procedures (also called subroutines). Python does not. 
(Or you could say that it makes procedures into functions with 
side-effects by returning None by default).

> x.f() is also a function, but it is a member of the object x, is
> referred to as a 'method' of x, and uses the syntactical "dot" notation
> object"dot"function for identification.
>
>> Referential opaqueness is usually such a source of problems that it
>> turns out good to contain the problem somewhat -- hence the wish for
>> encapsulation.
>>
>> One can find in the python library itself all 4 combinations:
>> syntactically and semantically OO : sort
>> syntactically and semantically FP: sorted
>> syntactically OO semantically FP: join
>


-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious 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