Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'argument': 0.05; 'plenty': 0.07; 'stops': 0.07; 'suddenly': 0.07; 'methods,': 0.09; 'raises': 0.09; 'subject:method': 0.09; 'violates': 0.09; 'worse': 0.09; 'cc:addr:python-list': 0.11; '10:49': 0.16; 'argument,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'pop()': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'breaking': 0.31; "d'aprano": 0.31; 'idea,': 0.31; 'steven': 0.31; 'class': 0.32; 'info': 0.35; 'something': 0.35; 'usual': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'really': 0.36; 'object,': 0.36; 'method': 0.36; 'subject:?': 0.36; 'being': 0.38; 'list,': 0.38; 'anything': 0.39; 'bad': 0.39; 'even': 0.60; 'skip:* 10': 0.61; 'name': 0.63; 'more': 0.64; 'default': 0.69; 'subject:Making': 0.84; 'careful': 0.91; 'info,': 0.91; 'to:none': 0.92 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:cc :content-type; bh=CXRLUUGJ9rT208RTRbBeBaeSQyw8zu/kdMVSU5vIzJ4=; b=D5jiRsGksklldyA/aETVRSJFOslvHs20uQyLLnozPNgNvojRRLNeYk7Mcw5CDoZYzm FUpzLCGQwYD570E7HrBx9vEu1w4m/QhreWcG5hdm9+Gsyn2F6kJw1FLgGE7bEPx3etWp oPgCMJpbKWOB4REVjbC6ff0TssgUkgYDBgRBXSZZyaw9uqiTadyrc8gd1Duwb3K+7YdM qFoGxmSyUryDOPNR5HMR3e5V9hQfMSQWA6KFbQv/AFbsmHNqGB9CH9B4+fzDysG4QBAW cl0YGZZ0OM/rDdc6yoc7mBHuervHIzXUXhaEnISqf3FqIbgh6zELcY8UIvY41JFL+HJ2 XQ9g== MIME-Version: 1.0 X-Received: by 10.50.138.195 with SMTP id qs3mr13139987igb.14.1407290878727; Tue, 05 Aug 2014 19:07:58 -0700 (PDT) In-Reply-To: <53e17b95$0$29981$c3e8da3$5496439d@news.astraweb.com> References: <53e17b95$0$29981$c3e8da3$5496439d@news.astraweb.com> Date: Wed, 6 Aug 2014 12:07:58 +1000 Subject: Re: Making every no-arg method a property? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1407291184 news.xs4all.nl 2959 [2001:888:2000:d::a6]:56132 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:75774 On Wed, Aug 6, 2014 at 10:49 AM, Steven D'Aprano wrote: > A > plethora of argument-less methods is a code smell -- that doesn't mean it's > *necessarily* a bad idea, but the class design really needs a careful > review. There are plenty of no-argument mutator methods, where the name of the method (and the target object, obviously) is all the info you need. You can clear() or copy() something with any more info, reverse() a list, pop() from a list, etc. (Okay, the last one has a default argument, but that raises an even worse point: adding a defaulted argument to a no-argument method suddenly stops it from being a property, which violates the usual rule that you can add a defaulted argument to anything without breaking anything.) ChrisA