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


Groups > comp.lang.python > #37133

Re: To make a method or attribute private

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subsequent': 0.04; '21,': 0.07; 'versions.': 0.07; 'python': 0.09; 'subject:method': 0.09; 'underscore': 0.09; 'programmer': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'reasonably': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'exists': 0.17; 'jan': 0.18; 'variable': 0.20; 'people,': 0.21; 'recognize': 0.22; "python's": 0.23; 'header:In-Reply-To:1': 0.25; 'possibly': 0.27; 'c++': 0.27; 'convention': 0.27; 'message-id:@mail.gmail.com': 0.27; 'smart': 0.29; 'expect': 0.31; 'conventions': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'should': 0.36; 'quite': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'think': 0.40; 'leading': 0.61; 'real': 0.61; 'skip:n 10': 0.63; '2013': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=2i8GA5Mep8mpKzeJJDBlcsrBbMnlHO2/Af96P5hDs0A=; b=hqXklGYS5WmTuA33msKhef4dVTxcWMxEUqA6Q+R5FXNkTVSHA7knR0gbe/QSZH4EW8 /C1DJfEgEKNHAqu8KdVs2PDTJiKgb+3QFU3fXcbuL/ezZilEZaeBAgptPHlZyiQtiCPl H1LEHezUrfdW0SteIha0EUkWqf2a+9T4jFmRLMCW7D+TwIEnrEVZVK3NHno6p+72XR6D IUW9iXbOeLSOUddNlHhGoCmwpYX4WpKIn5NfmQ5p9n+QZ9e1Ui8tuQlf8m6lMhD+fARa Avqn1xAjGcGDIM5owjmkm4mOWnmcr132SZw8ZL8AAB/PgsYGRY23IcUL/Jh9WAZjgKtn rSaA==
MIME-Version 1.0
X-Received by 10.220.156.10 with SMTP id u10mr17742474vcw.28.1358731578580; Sun, 20 Jan 2013 17:26:18 -0800 (PST)
In-Reply-To <d0e6254a-0e67-4b52-b4f5-f648bbb2a5b1@googlegroups.com>
References <mailman.584.1358382936.2939.python-list@python.org> <d0e6254a-0e67-4b52-b4f5-f648bbb2a5b1@googlegroups.com>
Date Mon, 21 Jan 2013 12:26:18 +1100
Subject Re: To make a method or attribute private
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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.714.1358731586.2939.python-list@python.org> (permalink)
Lines 13
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1358731586 news.xs4all.nl 6881 [2001:888:2000:d::a6]:60694
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:37133

Show key headers only | View raw


On Mon, Jan 21, 2013 at 12:14 PM, iMath <redstone-cold@163.com> wrote:
> so there is no REAL private variable in Python but conversion exists in it that python programmer should follow and recognize .right ?

That's about it. If you think about C++ public members as the
"interface" and private/protected members as the "implementation",
then Python's convention is a leading underscore on the latter; you
can reasonably expect that non-underscore members can be trusted to be
maintained, but underscored members will quite possibly change in
subsequent versions.

Among smart people, conventions like this are all you need.

ChrisA

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


Thread

To make a method or attribute private  "iMath" <2281570025@qq.com> - 2013-01-17 08:34 +0800
  Re: To make a method or attribute private alex23 <wuwei23@gmail.com> - 2013-01-16 17:04 -0800
    Re: To make a method or attribute private iMath <redstone-cold@163.com> - 2013-01-20 06:52 -0800
      Re: To make a method or attribute private Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-20 15:15 +0000
  Re: To make a method or attribute private Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-17 02:38 +0000
  Re: To make a method or attribute private iMath <redstone-cold@163.com> - 2013-01-20 17:14 -0800
    Re: To make a method or attribute private Chris Angelico <rosuav@gmail.com> - 2013-01-21 12:26 +1100
    Re: To make a method or attribute private Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-21 03:27 +0000
      Re: To make a method or attribute private Chris Angelico <rosuav@gmail.com> - 2013-01-21 15:46 +1100
        Re: To make a method or attribute private alex23 <wuwei23@gmail.com> - 2013-01-20 21:44 -0800

csiph-web