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


Groups > comp.lang.python > #52648

Re: Python getters and setters

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!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.111
X-Spam-Level *
X-Spam-Evidence '*H*': 0.79; '*S*': 0.01; 'subject:Python': 0.06; 'method.': 0.07; 'dog': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'method;': 0.16; 'which,': 0.16; 'wrote:': 0.18; 'programming': 0.22; 'aug': 0.22; "shouldn't": 0.24; 'read,': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'too.': 0.31; 'about.': 0.31; "d'aprano": 0.31; 'provide.': 0.31; 'steven': 0.31; 'interface': 0.32; 'classes': 0.35; 'something': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'should': 0.36; 'step': 0.37; 'being': 0.38; 'to:addr:python-list': 0.38; 'bad': 0.39; 'to:addr:python.org': 0.39; 'most': 0.60; "you're": 0.61; 'provide': 0.64; 'customers': 0.66; 'walk': 0.74; 'dog.': 0.84; 'limits,': 0.84; 'careful': 0.91; 'walking': 0.91; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=pbDo+QXDnlLmpNfwvVy5VDPuEOZWnRqXNNz3+G4W1Uk=; b=vFBPOfJDAx4VjGeYye7XrIS+YkTVeOOfg7FAkAbSjbUNnfJ2u9atbwIe+GS5ArqjhR wlwvmSQNBvN6r3C9zTgvfP/L4WytJo7W6wmyC7XjM90763hHIvjG68jyaW3zp6ohvSv1 Pxut8cBhYL2Aliia8pMA6VB8bmt9mFrVAyoOfyB3VRwoSDb8pvCuNcyx7Bbq0eEhNjDW adHnilzlzNqYxceiLnRcWmGUzJq6ziHLuRQf0HZf5Ubi3iJqWNVKiDDjKnGexOKRuYnk UA4jVCm9B+Mu6WdJN1aGgWdp1su3soeFX/JPYlRukUmQAZu34rDaFNX0/7n7C1rjvhHT OgKA==
MIME-Version 1.0
X-Received by 10.52.73.135 with SMTP id l7mr4830923vdv.9.1376788036684; Sat, 17 Aug 2013 18:07:16 -0700 (PDT)
In-Reply-To <521009ee$0$30000$c3e8da3$5496439d@news.astraweb.com>
References <227bd47c-0e86-4d65-985f-e59aa4f25294@googlegroups.com> <520fb04f$0$30000$c3e8da3$5496439d@news.astraweb.com> <520ffe9a$0$15920$e4fe514c@news.xs4all.nl> <521009ee$0$30000$c3e8da3$5496439d@news.astraweb.com>
Date Sun, 18 Aug 2013 02:07:16 +0100
Subject Re: Python getters and setters
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.22.1376788044.23369.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1376788044 news.xs4all.nl 15903 [2001:888:2000:d::a6]:50540
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:52648

Show key headers only | View raw


On Sun, Aug 18, 2013 at 12:40 AM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> The Law of Demeter is really about being careful about what interface
> your classes provide. Customers should provide a get_payment method; dogs
> should provide a walk method. You shouldn't have to send individual step
> messages to the dog's legs.

And it has its limits, too. If you're walking a dog on a leash, you
don't send a message to the leash to send a message to the dog to
walk. You talk directly to the dog. Like most programming principles,
it's something to read, to grok, and then to think about. I have yet
to find any rule which, if slavishly followed, will not lead to bad
code _somewhere_.

ChrisA

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


Thread

Python getters and setters Fernando Saldanha <fsaldan1@gmail.com> - 2013-08-17 09:53 -0700
  Re: Python getters and setters MRAB <python@mrabarnett.plus.com> - 2013-08-17 18:10 +0100
  Re: Python getters and setters Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-17 17:18 +0000
    Re: Python getters and setters Tim Chase <python.list@tim.thechases.com> - 2013-08-17 12:31 -0500
    Re: Python getters and setters Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2013-08-18 00:52 +0200
      Re: Python getters and setters Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-17 23:40 +0000
        Re: Python getters and setters Chris Angelico <rosuav@gmail.com> - 2013-08-18 02:07 +0100
  Re: Python getters and setters Fernando Saldanha <fsaldan1@gmail.com> - 2013-08-17 22:26 -0700

csiph-web