Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!bcyclone04.am1.xlned.com!bcyclone04.am1.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: 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; 'attribute': 0.07; 'mentioned,': 0.07; 'method.': 0.07; 'style.': 0.09; 'subject:method': 0.09; 'cc:addr:python-list': 0.11; "wouldn't": 0.14; 'changes': 0.15; 'agreed,': 0.16; 'assignment.': 0.16; 'attribute,': 0.16; 'boolean': 0.16; 'foo()': 0.16; 'wrote:': 0.18; 'discussion': 0.18; 'cc:addr:python.org': 0.22; 'instance,': 0.24; 'question': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'pass': 0.26; 'asking': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'related': 0.29; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; '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; 'case,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'possible': 0.36; 'subject:?': 0.36; 'received:209': 0.37; 'pm,': 0.38; '12,': 0.39; 'new': 0.61; 'simple': 0.61; 'such': 0.63; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'between': 0.67; 'obvious': 0.74; 'capture': 0.91; 'subject:skip:w 20': 0.91 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=bwoPDOS06UU5/IJD1JCYnaU5u1qZT2LL9zYm1yOQIkw=; b=IECFR9T3foBuhkfL3MmDATZcPKq2JZR+insFd051pyfygvedLy8Cu6KLtOQpqUySe6 WqCxvGZngDIzsta/v4eaTTQARbr5J2eiebU2HOGkKhU8cg7r2c1ZaeFMaZ1cfWzmtI/X wYUGoLOzxy2Satv/JvyrbHwGFG0PjOerfR7T3AOp1JvIMzOAlYo83BeE5YkpHFZ3jirc YaGmNbUn+DzV2luucOaLtaphWxfKtUVS9MQqtZc23NCnFaggBSmSiiLjNZdSxGHEVnT8 q7q+PXD38j/SuVgzASWwUkqn1ueZP3j0FkIXdek5ePNSaQfMvkoYc2Tcu/DMFZ1wIxwV bsog== X-Gm-Message-State: ALoCoQkZvyXUBJhuxdR4QCTcUeHHi96cD5iJHtRmtXHD8CKjTWkpHdP54sfxNY23BvKG4YQjTmH0 X-Received: by 10.180.99.163 with SMTP id er3mr10931600wib.18.1418418236253; Fri, 12 Dec 2014 13:03:56 -0800 (PST) MIME-Version: 1.0 X-Originating-IP: [46.28.50.100] In-Reply-To: References: From: Mateusz Loskot Date: Fri, 12 Dec 2014 22:03:26 +0100 Subject: Re: is_ as method or property? To: Chris Angelico 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1418418244 news.xs4all.nl 2948 [2001:888:2000:d::a6]:53745 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 4613 X-Received-Body-CRC: 1762906339 Xref: csiph.com comp.lang.python:82467 On 12 December 2014 at 12:26, Chris Angelico wrote: > On Fri, Dec 12, 2014 at 10:21 PM, Mateusz Loskot 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: >> > > 0) Attribute only. > > class Foo: > pass > > Foo().default = True > > Unless you need something more than this, go with this style. Much simpler. Agreed, in general, but if the question was related to such simple case, I wouldn't bother asking it. 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. Best regards, -- Mateusz Loskot, http://mateusz.loskot.net