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


Groups > comp.lang.python > #31025

Re: Private methods

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'one?': 0.05; 'class,': 0.07; 'correct.': 0.07; 'python': 0.09; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'underlying': 0.09; 'underscore': 0.09; 'url:faqs': 0.09; 'interfaces': 0.15; 'kern': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'url:catb': 0.16; 'usenet': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'thanks.': 0.21; 'interpret': 0.22; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'first,': 0.27; 'question': 0.27; 'convention': 0.27; "doesn't": 0.28; 'header:X-Complaints-To:1': 0.28; 'about.': 0.29; 'usually': 0.30; 'on,': 0.30; 'point': 0.31; 'could': 0.32; 'explains': 0.33; 'to:addr:python-list': 0.33; 'faster': 0.35; 'robert': 0.35; 'pm,': 0.35; 'sometimes': 0.35; 'received:org': 0.36; 'but': 0.36; 'url:org': 0.36; 'method': 0.36; 'why': 0.37; 'ones': 0.37; 'rather': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'things': 0.38; 'talk': 0.38; 'page': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'skip:u 10': 0.60; 'real': 0.61; 'world': 0.63; 'our': 0.65; 'believe': 0.69; 'eco': 0.84; 'hardly': 0.84; 'terrible': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Robert Kern <robert.kern@gmail.com>
Subject Re: Private methods
Date Tue, 09 Oct 2012 15:12:47 +0100
References <1krpbz9.1wge3j11123k2vN%real-not-anti-spam-address@apple-juice.co.uk> <mailman.1994.1349790529.27098.python-list@python.org> <1krpdak.u0qy9e1a4knspN%real-not-anti-spam-address@apple-juice.co.uk>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host 213.1.240.227
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:15.0) Gecko/20120907 Thunderbird/15.0.1
In-Reply-To <1krpdak.u0qy9e1a4knspN%real-not-anti-spam-address@apple-juice.co.uk>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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.1996.1349791978.27098.python-list@python.org> (permalink)
Lines 43
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1349791978 news.xs4all.nl 6881 [2001:888:2000:d::a6]:38916
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:31025

Show key headers only | View raw


On 10/9/12 2:59 PM, D.M. Procida wrote:
> Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
>
>> On 09/10/2012 14:24, D.M. Procida wrote:
>>> What exactly is the point of a private method? Why or when would I want
>>> to use one?
>>>
>>> Daniele
>>>
>>
>> Hardly a Python question but using a search engine could have got you
>> here, and rather faster :)
>>
> http://stackoverflow.com/questions/2620699/why-private-methods-in-the-ob
> ject-oriented
>
> Thanks. Sometimes I prefer to talk to real people on Usenet than do web
> searches. Just my preference.

That's understandable, but the real people on Usenet who will answer your 
questions usually prefer that you do a web search first, for a variety of reasons.

   http://www.catb.org/esr/faqs/smart-questions.html#before

> Anyway, one of the answers on that page explains that public methods are
> interfaces to a class, that other things might rely on, and private ones
> are for its own internal logic, that other things don't need to care
> about.
>
> In Python, using an underscore is simply a convention to note that a
> method is private - it doesn't actually hide it from other things -
> correct?

This is correct.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

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


Thread

Private methods real-not-anti-spam-address@apple-juice.co.uk (D.M. Procida) - 2012-10-09 14:24 +0100
  Re: Private methods Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-10-09 14:51 +0100
    Re: Private methods real-not-anti-spam-address@apple-juice.co.uk (D.M. Procida) - 2012-10-09 14:59 +0100
      Re: Private methods Demian Brecht <demianbrecht@gmail.com> - 2012-10-09 07:08 -0700
      Re: Private methods Robert Kern <robert.kern@gmail.com> - 2012-10-09 15:12 +0100
      Re: Private methods Tim Chase <python.list@tim.thechases.com> - 2012-10-09 09:21 -0500
      Re: Private methods Ian Kelly <ian.g.kelly@gmail.com> - 2012-10-09 11:08 -0600
        Re: Private methods Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-09 23:51 +0000
          Re: Private methods Demian Brecht <demianbrecht@gmail.com> - 2012-10-09 17:26 -0700
            Re: Private methods real-not-anti-spam-address@apple-juice.co.uk (D.M. Procida) - 2012-10-10 08:03 +0100
              Re: Private methods alex23 <wuwei23@gmail.com> - 2012-10-10 18:34 -0700
                Re: Private methods Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-11 02:08 +0000
                Re: Private methods Dieter Maurer <dieter@handshake.de> - 2012-10-11 08:04 +0200
          Re: Private methods Robert Kern <robert.kern@gmail.com> - 2012-10-10 13:47 +0100
          Re: Private methods Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-01 16:45 -0600
      Re: Private methods Roy Smith <roy@panix.com> - 2012-10-10 09:08 -0400
        Re: Private methods Ramchandra Apte <maniandram01@gmail.com> - 2012-10-10 08:56 -0700
          Re: Private methods Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-10-10 17:13 +0100
            Re: Private methods Grant Edwards <invalid@invalid.invalid> - 2012-10-10 16:30 +0000
            Re: Private methods alex23 <wuwei23@gmail.com> - 2012-10-10 18:39 -0700
  Re: Private methods 88888 Dihedral <dihedral88888@googlemail.com> - 2012-10-10 20:11 -0700

csiph-web