X-Received: by 10.107.15.91 with SMTP id x88mr21565516ioi.3.1458022185825; Mon, 14 Mar 2016 23:09:45 -0700 (PDT) X-Received: by 10.50.87.40 with SMTP id u8mr356854igz.0.1458022185799; Mon, 14 Mar 2016 23:09:45 -0700 (PDT) Path: csiph.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.glorb.com!av4no655649igc.0!news-out.google.com!pn7ni10180igb.0!nntp.google.com!nt3no1783216igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.python Date: Mon, 14 Mar 2016 23:09:45 -0700 (PDT) In-Reply-To: <0f3936b8-9a77-4981-bfd0-802d3392e567@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=172.58.105.143; posting-account=h3aEwQoAAACiuqX-oR3gvCVFm8lLHoWj NNTP-Posting-Host: 172.58.105.143 References: <56E17985.7060002@benmezger.nl> <6984dafc-fffd-4d46-a173-421bb5c142d2@googlegroups.com> <4ddc3696-3f71-4598-98a6-929267f51fb9@googlegroups.com> <0f3936b8-9a77-4981-bfd0-802d3392e567@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Encapsulation in Python From: Rick Johnson Injection-Date: Tue, 15 Mar 2016 06:09:45 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: csiph.com comp.lang.python:104920 On Monday, March 14, 2016 at 1:12:14 PM UTC-5, sohca...@gmail.com wrote: [...a whole lot of my quotes, snipped for bandwidth...] @GROUP: I don't know what the heck happened in this thread, but everyone involved was having a nice respectful conversation about encapsulation, interfaces, and modules, and then BartC and Mark showed up, and the thread went off on a wild tangent. Whilst the participation of members and the CoC are important topics, i hope we put aside these petty issues, and get back to productive discussions soon. Thanks. > I don't think you'll find anyone that disagrees with you > here. > > If you're seeing a method "width", then whoever wrote that > method is a terrible programmer. Method names should > *always* contain some sort of verb. As you just said, > self-documenting names are the key to short learning > curves. > > IMO, if you intend an attribute to be read-only, then you > should use a getter, even in Python, Even though many of our fellow members would argue that this is overkill, your advice is good advice, and i strongly support this position. > and of course prefix the actual value with an underscore > to show it should not be accessed publicly. Agreed! > The only time you should see "someObject.width" is if > width is both readable and writable. Of course, Using > @property to add some logic to the setting/getting is > fine. Yes. More wonderful, and consistent, advice here. You sir, have restored my faith in humanity.