Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:while': 0.09; '"if"': 0.16; 'boolean': 0.16; 'evaluating': 0.16; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; "isn't.": 0.16; 'message-id:@dough.gmane.org': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'stefan': 0.17; 'implicit': 0.22; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'andrew': 0.27; 'header:X-Complaints- To:1': 0.28; 'chris': 0.28; 'objects': 0.29; 'probably': 0.29; 'implement': 0.32; 'received:84': 0.32; 'to:addr:python-list': 0.33; 'said,': 0.35; 'there': 0.35; 'received:org': 0.36; 'but': 0.36; 'test': 0.36; 'why': 0.37; 'subject:: ': 0.38; 'nothing': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'truth': 0.75; 'received:arcor-ip.net': 0.84; 'received:pools .arcor-ip.net': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Stefan Behnel Subject: Re: Implicit conversion to boolean in if and while statements Date: Sun, 15 Jul 2012 11:17:12 +0200 References: <500280A6.6070608@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: dslb-084-056-049-167.pools.arcor-ip.net User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 In-Reply-To: <500280A6.6070608@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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1342343843 news.xs4all.nl 6934 [2001:888:2000:d::a6]:53187 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25344 Andrew Berg, 15.07.2012 10:34: > This has probably been discussed before, but why is there an implicit > conversion to a boolean in if and while statements? There isn't. This has nothing to do with "if" or "while". All objects have a truth value in Python, evaluating to True by default (object), unless they implement the test themselves. As Chris said, very convenient. Stefan