Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #37139
| References | <mailman.584.1358382936.2939.python-list@python.org> <d0e6254a-0e67-4b52-b4f5-f648bbb2a5b1@googlegroups.com> <50fcb5a9$0$11101$c3e8da3@news.astraweb.com> |
|---|---|
| Date | 2013-01-21 15:46 +1100 |
| Subject | Re: To make a method or attribute private |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.717.1358743571.2939.python-list@python.org> (permalink) |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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