Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #17223
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <prvs=322fd6406=jeanmichel@sequans.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'attributes': 0.05; 'instance,': 0.05; 'attribute': 0.07; 'lately': 0.07; 'tends': 0.07; "everyone's": 0.09; 'mutable': 0.09; 'necessary,': 0.09; 'am,': 0.12; 'def': 0.13; 'argument': 0.15; '@property': 0.16; 'arbitrarily': 0.16; 'methods,': 0.16; 'opposed,': 0.16; 'versus': 0.16; 'cc:addr:python-list': 0.16; 'wed,': 0.17; 'wrote:': 0.18; 'instance': 0.18; 'cc:no real name:2**0': 0.20; 'cheers,': 0.20; 'dec': 0.22; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'figure': 0.23; 'breaks': 0.23; 'complain': 0.23; "python's": 0.24; 'classes': 0.26; 'code.': 0.26; 'all,': 0.28; 'cc:addr:gmail.com': 0.28; 'cc:addr:python.org': 0.29; 'second': 0.29; 'kelly': 0.30; 'useless': 0.30; "i've": 0.31; 'dependent': 0.32; 'wondering': 0.32; "can't": 0.32; 'header:User-Agent:1': 0.33; 'decide': 0.33; 'something': 0.35; 'switch': 0.35; 'properties': 0.36; 'cc:2**1': 0.36; 'drives': 0.37; 'variables': 0.37; "there's": 0.37; 'doing': 0.38; 'using': 0.38; 'plain': 0.39; 'more': 0.61; '2011': 0.61; 'property': 0.63; 'direct': 0.67; 'received:62': 0.70; '.net,': 0.84; 'low,': 0.84; 'nuts': 0.84; 'subject:Property': 0.84; 'value):': 0.84; 'subject:Abuse': 0.91 |
| X-IronPort-AV | E=Sophos;i="4.71,353,1320620400"; d="scan'208";a="41990" |
| X-Virus-Scanned | amavisd-new at zimbra.sequans.com |
| Date | Wed, 14 Dec 2011 17:37:15 +0100 |
| From | Jean-Michel Pichavant <jeanmichel@sequans.com> |
| User-Agent | Mozilla-Thunderbird 2.0.0.24 (X11/20100328) |
| MIME-Version | 1.0 |
| To | Ian Kelly <ian.g.kelly@gmail.com> |
| Subject | Re: Property Abuse |
| References | <CAAfDykva2jyARQpAxrLK2V4UD_G56ZTxX0b+HSHHsdQyPma_YA@mail.gmail.com> <CALwzidn3EO1en5Rq9GfD7rNqgogJziy6kMAMa7kFow0Gezj53Q@mail.gmail.com> |
| In-Reply-To | <CALwzidn3EO1en5Rq9GfD7rNqgogJziy6kMAMa7kFow0Gezj53Q@mail.gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Cc | python-list@python.org, Felipe O <pip.261@gmail.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| 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.3648.1323880638.27778.python-list@python.org> (permalink) |
| Lines | 41 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1323880638 news.xs4all.nl 6866 [2001:888:2000:d::a6]:56452 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:17223 |
Show key headers only | View raw
Ian Kelly wrote: > On Wed, Dec 14, 2011 at 1:28 AM, Felipe O <pip.261@gmail.com> wrote: > >> Hi All, >> I was wondering what everyone's thought process was regarding properties. >> Lately I find I've been binging on them and have classes with > 10 >> properties. While pylint doesn't complain (yet), it tends to be picky about >> keeping instance attribute counts low, so I figure there's something against >> that. How do you guys decide between using properties versus getter methods, >> or how do you refactor them if neither? >> > > I prefer direct instance attribute access where possible*, properties > where necessary, and methods where an argument is needed or the > relationship is more complex than get/set/delete. > > * One of the strengths of Python's property system** is that you can > switch between plain attributes and mutable properties as needed > without breaking dependent code. Often I see people doing this, which > drives me nuts with its useless verbosity, when a plain instance > attribute would have sufficed: > > @property > def foo(self): > return self._foo > > @foo.setter > def foo(self, value): > self._foo = value > > ** As opposed, for instance, to the .NET property system. You can't > arbitrarily switch between public member variables and public > properties in .NET, because it breaks ABI. > > Cheers, > Ian > I second this opinion, plain attributes are what's required most of the time. JM
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Property Abuse Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-12-14 17:37 +0100
csiph-web