Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82555
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <mateusz@loskot.net> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.010 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'explicit': 0.07; 'mentioned,': 0.07; 'method.': 0.07; 'subject:method': 0.09; 'cc:addr:python-list': 0.11; 'changes': 0.15; 'assignment.': 0.16; 'attribute,': 0.16; 'attribute.': 0.16; 'boolean': 0.16; 'expensive,': 0.16; 'fail,': 0.16; 'foo()': 0.16; 'partly': 0.16; 'thread,': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'wrote:': 0.18; 'discussion': 0.18; 'cheap': 0.19; '>>>': 0.22; 'issue.': 0.22; 'cc:addr:python.org': 0.22; 'instance,': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; "i've": 0.25; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; '>>>>': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'with,': 0.31; 'class': 0.32; 'received:209.85.212': 0.32; 'cases': 0.33; 'fri,': 0.33; 'received:209.85': 0.35; 'december': 0.35; 'something': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'thanks': 0.36; 'possible': 0.36; 'subject:?': 0.36; 'received:209': 0.37; 'depends': 0.38; 'pm,': 0.38; '12,': 0.39; 'skip:u 10': 0.60; 'tell': 0.60; 'new': 0.61; 'personal': 0.63; 'more': 0.64; 'afraid': 0.65; 'between': 0.67; 'obvious': 0.74; 'all!': 0.84; 'updated,': 0.84; 'capture': 0.91; 'subject:skip:w 20': 0.91; 'confirms': 0.95 |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=45vj8YNWaTc80hx4SdPOhqIdFC5a84JxZmBDZZIipho=; b=KuW9J8mzcQdtGv+DRISVhisJnkIPSxEFXJKfrTYqJeojWSGfgeRPkJanayR+sbrKXJ k4Imhb9olYbx4a3iX2MU7QVqNF/nwTyt8xWSJp39qahmIZYNaOMqlnWzpLFyeHK7/XvP 4iP7hlANMGLX9AVtRtpVPx3c89ik2SOZGDIuCWv2Qu8i1ETZta3xYb9xcmxMOcJ6X+8/ 63D0VUmD1NlZ06s2s9GvsKR39WdCFRGqGPZ4Vl8WYbQliGruf1ucHYgeRzx2Nd4HSegs vWoW/2mC9TXLrjBsg1YBbtE+MHMUVGYGZLxqhKikmrtHaVWlUjxmviuRUEvdFb0N656h wAsA== |
| X-Gm-Message-State | ALoCoQkbjBYRas2ReyqgzMGLKEBLgeKdJ6fu9W8Fy+c3TSoyLKPiBqG4vtsLeE9YSbvaYMuZm+BQ |
| X-Received | by 10.194.92.37 with SMTP id cj5mr50810076wjb.81.1418637446330; Mon, 15 Dec 2014 01:57:26 -0800 (PST) |
| MIME-Version | 1.0 |
| X-Originating-IP | [185.21.150.254] |
| In-Reply-To | <548c21e2$0$13005$c3e8da3$5496439d@news.astraweb.com> |
| References | <CABUeae-rNeN_dGgkgauNr+-qChXvkgenBmgLbFioe+JDqiT+Hg@mail.gmail.com> <CAPTjJmojWeyB_bv-6Rjzkno6Cb7NiUKo7rt4Th6fvNPOsGv_jQ@mail.gmail.com> <CABUeae9ukrw8iYan+iFj_6-V7LT0MVm+heVDWv7zEkqEAMim+g@mail.gmail.com> <CAPTjJmpOX2pEgJM7AgOWeOge5+H=QNUd2KH9nKC34PBVJSDUYQ@mail.gmail.com> <mailman.16927.1418418244.18130.python-list@python.org> <548c21e2$0$13005$c3e8da3$5496439d@news.astraweb.com> |
| From | Mateusz Loskot <mateusz@loskot.net> |
| Date | Mon, 15 Dec 2014 10:56:56 +0100 |
| Subject | Re: is_<whatever_you_are_testing_for> as method or property? |
| To | "Steven D'Aprano" <steve+comp.lang.python@pearwood.info> |
| Content-Type | text/plain; charset=UTF-8 |
| 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.16978.1418637454.18130.python-list@python.org> (permalink) |
| Lines | 33 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1418637454 news.xs4all.nl 2944 [2001:888:2000:d::a6]:42993 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:82555 |
Show key headers only | View raw
On 13 December 2014 at 12:24, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > Mateusz Loskot wrote: > >> On 12 December 2014 at 12:26, Chris Angelico <rosuav@gmail.com> wrote: >>> On Fri, Dec 12, 2014 at 10:21 PM, Mateusz Loskot <mateusz@loskot.net> >>> wrote: >>>> I've got several cases which are not obvious to me. >>>> For instance, class Foo has a boolean attribute, read-write, >>>> which I see a couple of realisations for possible: > [...] >> I mentioned, setting the new value involves more changes to Foo() >> instance, so i's not possible to capture it with just an assignment. >> Hence, the discussion between property vs method. > > If the calculation is cheap and fast and "feels like" getting/setting an > attribute, then use property. > > If the calculation is expensive, or might fail, then use explicit > getter/setter methods. > > I'm afraid that there is no objective way to tell when something "feels > like" an attribute. That depends partly on the class you are dealing with, > and partly on personal taste. That confirms my now updated, thanks to this thread, understanding of that issue. Thanks all! Best regards, -- Mateusz Loskot, http://mateusz.loskot.net
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: is_<whatever_you_are_testing_for> as method or property? Mateusz Loskot <mateusz@loskot.net> - 2014-12-12 22:03 +0100
Re: is_<whatever_you_are_testing_for> as method or property? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-12-13 22:24 +1100
Re: is_<whatever_you_are_testing_for> as method or property? Mateusz Loskot <mateusz@loskot.net> - 2014-12-15 10:56 +0100
csiph-web