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

References <mailman.584.1358382936.2939.python-list@python.org> <d0e6254a-0e67-4b52-b4f5-f648bbb2a5b1@googlegroups.com>
Date 2013-01-21 12:26 +1100
Subject Re: To make a method or attribute private
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.714.1358731586.2939.python-list@python.org> (permalink)

Show all headers | 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