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


Groups > comp.lang.python > #37139

Re: To make a method or attribute private

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!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.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'float': 0.05; '#define': 0.07; '21,': 0.07; 'exist,': 0.07; 'python': 0.09; 'subject:method': 0.09; 'programmer': 0.11; 'languages.': 0.15; '"#define': 0.16; 'argument.': 0.16; 'easier.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'java.': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'exists': 0.17; 'pointer': 0.17; 'jan': 0.18; 'saying': 0.18; 'memory': 0.18; 'variable': 0.20; 'trying': 0.21; 'recognize': 0.22; 'strip': 0.22; 'header:In-Reply-To:1': 0.25; 'raw': 0.27; 'c++': 0.27; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; "d'aprano": 0.29; 'enforce': 0.29; 'steven': 0.29; 'style.': 0.29; 'code': 0.31; "aren't": 0.33; 'int': 0.33; 'point,': 0.33; 'to:addr :python-list': 0.33; 'agree': 0.34; 'received:google.com': 0.34; 'fail': 0.35; 'pm,': 0.35; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'there': 0.35; 'but': 0.36; 'anything': 0.36; 'should': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'your': 0.60; 'most': 0.61; 'real': 0.61; 'privacy': 0.65; '2013': 0.84; 'reflection': 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=fwYKvpICu1eOidH4lLHmPaR5FQvSbIEGxRyv1S6LzCQ=; b=HULsMFeEs4esgVRDREg1x4ib5EJTOa/dtp96FyqVXfcDQckn/KXou0iXbZs9iX3q0A n396qhceGjm6vOzEOatabr4THHCNXrVVsn7JXVzR4s3QpUU57cxVZ/vUNU9SZrsW6o86 RCN28yyyNV+8bT44C/sAwoisE3kMLRKJNB7lEOUKCrj8fUTQOcMhv2RCH8GIz090ohL7 7p19VowEm+fi50BkC9yD0lQ+7hKH+qzdGgbjlSQUT/lEeABEVk/rdjUpYgj5Cv7OyiWv Dtf/xwqHLJYAGRwYrv3omiCr2N+wFxJyD4raX7MBGI1k/RAY3em5wC983uPZ5booKX+M yq9g==
MIME-Version 1.0
X-Received by 10.220.150.136 with SMTP id y8mr17900142vcv.34.1358743568099; Sun, 20 Jan 2013 20:46:08 -0800 (PST)
In-Reply-To <50fcb5a9$0$11101$c3e8da3@news.astraweb.com>
References <mailman.584.1358382936.2939.python-list@python.org> <d0e6254a-0e67-4b52-b4f5-f648bbb2a5b1@googlegroups.com> <50fcb5a9$0$11101$c3e8da3@news.astraweb.com>
Date Mon, 21 Jan 2013 15:46:07 +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.717.1358743571.2939.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1358743571 news.xs4all.nl 6944 [2001:888:2000:d::a6]:52094
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:37139

Show key headers only | View raw


On Mon, Jan 21, 2013 at 2:27 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> On Sun, 20 Jan 2013 17:14:36 -0800, iMath wrote:
>
> [...]
>> so there is no REAL private variable in Python but conversion exists in
>> it that python programmer should follow and recognize .right ?
>
> There are no "REAL private variables" in most languages. Consider the C++
> trick "#define private public". Or pointer tricks, or using reflection in
> Java.

Uhh, that's like saying there are no REAL floats in C, because you can
#define float int
And pointer tricks, well, you can do anything with raw memory access.
These aren't proofs that something doesn't exist, they're proofs that
trying to enforce privacy is bound to fail - so you may as well strip
that code from your compiler/interpreter and go with the Python style.
Much easier.

I agree with your point, just not your argument. :)

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