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


Groups > comp.lang.python > #52648

Re: Python getters and setters

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 2013-08-18 02:07 +0100
Subject Re: Python getters and setters
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.22.1376788044.23369.python-list@python.org> (permalink)

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