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


Groups > comp.lang.python > #80152

Re: Classes

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <prvs=377d4667d=jeanmichel@sequans.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.027
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'python.': 0.02; 'decorator': 0.09; 'rewrite': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'class)': 0.16; 'descriptor': 0.16; 'incorrect': 0.16; 'subject:Classes': 0.16; 'utterly': 0.16; 'wrote:': 0.18; 'basically': 0.19; 'preferred': 0.22; 'cc:addr:python.org': 0.22; 'greg': 0.24; 'java': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'on,': 0.29; 'statement': 0.30; "i'm": 0.30; 'code': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'class': 0.32; '-----': 0.33; '"the': 0.34; 'agree': 0.35; 'definition': 0.35; 'one,': 0.35; 'but': 0.35; 'changing': 0.37; 'wrong': 0.37; 'thank': 0.38; 'sure': 0.39; 'course': 0.61; 'you.': 0.62; 'information': 0.63; 'organization': 0.63; 'received:194': 0.64; 'notice:': 0.67; 'person,': 0.68; 'privileged.': 0.69; 'disclose': 0.74; 'hate': 0.91; 'medium.': 0.91
X-IronPort-AV E=Sophos;i="5.07,307,1413237600"; d="scan'208";a="3542504"
Date Mon, 3 Nov 2014 13:41:41 +0100 (CET)
From Jean-Michel Pichavant <jeanmichel@sequans.com>
To Gregory Ewing <greg.ewing@canterbury.ac.nz>
In-Reply-To <cbmj2qFfr1vU1@mid.individual.net>
Subject Re: Classes
MIME-Version 1.0
X-Mailer Zimbra 7.2.7_GA_2942 (ZimbraWebClient - GC37 (Linux)/7.2.7_GA_2942)
Content-Type text/plain; charset="utf-8"
Content-Transfer-Encoding base64
Cc python-list@python.org
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 <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.15427.1415018508.18130.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1415018508 news.xs4all.nl 2943 [2001:888:2000:d::a6]:35242
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:80152

Show key headers only | View raw


----- Original Message -----
> From: "Gregory Ewing" <greg.ewing@canterbury.ac.nz>
> Steven D'Aprano wrote:
> > Like all good Pythonistas[1], we hate Java and think that
> > getter/setter
> > methods are pointless. But come on, they're not *wrong*,
> 
> What's wrong is the statement that getters and setters
> are necessary to allow the implementation to change
> without changing the interface. That's factually
> incorrect in regard to Python.
> 
> --
> Greg

I'm not sure that is what the course was stating:

"The advantage of
following this practice is that the implementer of the class
definition (often someone other than the user of the class) may
restructure the organization of the data fields associated with the
object while avoiding the need to rewrite code that uses the class."

I agree with Steven on that one, while getters/setters are not the preferred way, they are not utterly wrong.
Python uses the descriptor protocol which is basically getters and setters. It's is just hidden by a strange decorator syntax.

JM


-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

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


Thread

Re: Classes Jean-Michel Pichavant <jeanmichel@sequans.com> - 2014-11-03 13:41 +0100
  Re: Classes Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-11-04 18:38 +1300

csiph-web