Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '16,': 0.03; 'explicitly': 0.04; 'method.': 0.05; '"if': 0.09; 'bool': 0.09; 'subject:while': 0.09; 'cc:addr:python-list': 0.10; 'stack': 0.15; 'container.': 0.16; 'eliminating': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'meant': 0.21; 'assuming': 0.22; 'tells': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'idea': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'container': 0.29; "d'aprano": 0.29; 'steven': 0.29; 'classes': 0.30; 'received:209.85.160.46': 0.32; 'could': 0.32; 'asked': 0.33; 'interface,': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'something': 0.35; 'should': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'instead': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'jul': 0.65; 'reply': 0.66; 'talking': 0.66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=P/iBF8r6X1rmDF5g8UpyNlwEjEMJvm9w3tcILnFI2H4=; b=mjGZ63qIp+HE1zuIvX9+jlqpZav2aVTD4nvrfeevugtzfrw2WTvCRtgJByGvVPgOz5 upE6eypdJYCKZmWuyfDkIJC7ZjBPmwGj+exUsOgYcKJdl/jyjni5od07HBxKJw6ter+3 AW9KVgmtUaMcXUpqiVJhFP12+XP4GxrLGQrQpg2PzLYAtRTmTqUrB9Xj0MTQ87tYDp0y yhCnC6cnG+m78dTPRxl/lLWHZx5NSRw6sJ1IG+mzr1tYDYgZcBerGPB2n0Ij/u80KjVj vpTqvc9tEX2jSWNsjKmIPmX8OBkdy9tcVyhnrOGaV/tEmKPV30ujaBZBwm+X3aPepjX9 1poA== MIME-Version: 1.0 In-Reply-To: <50039290$0$29978$c3e8da3$5496439d@news.astraweb.com> References: <5002a1f9$0$29995$c3e8da3$5496439d@news.astraweb.com> <7b027612-a07e-40f9-8ad2-3e95c5440482@googlegroups.com> <86872ad2-fda0-403b-9f18-d1cb18e41860@t32g2000yqd.googlegroups.com> <50039290$0$29978$c3e8da3$5496439d@news.astraweb.com> From: Devin Jeanpierre Date: Tue, 17 Jul 2012 00:18:28 -0400 Subject: Re: Implicit conversion to boolean in if and while statements To: "Steven D'Aprano" Content-Type: text/plain; charset=UTF-8 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1342498752 news.xs4all.nl 6868 [2001:888:2000:d::a6]:57446 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25455 On Mon, Jul 16, 2012 at 12:03 AM, Steven D'Aprano wrote: > On Sun, 15 Jul 2012 22:15:13 -0400, Devin Jeanpierre wrote: > >> For example, instead of "if stack:" or "if bool(stack):", we could use >> "if stack.isempty():". This line tells us explicitly that stack is a >> container. > > isempty is not a container method. Your entire reply is predicated on this idea that I was talking about writing classes with this extra "isempty" method. No. I was talking about having "isempty" be part of the collection interface, and eliminating polymorphic bool conversion. If you were confused, instead of assuming I meant something patently absurd, you should have asked for a clarification. -- Devin