Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!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.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'cpython': 0.05; 'none:': 0.05; 'false.': 0.07; 'subject:while': 0.09; 'through.': 0.09; "wouldn't": 0.11; 'boolean': 0.16; 'windows': 0.19; 'received:209.85.214.174': 0.21; 'implicit': 0.22; 'seems': 0.23; 'header:User-Agent:1': 0.26; 'converting': 0.27; 'prints': 0.29; 'probably': 0.29; 'point': 0.31; 'values.': 0.33; 'to:addr:python- list': 0.33; 'received:google.com': 0.34; 'false': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'message- id:@gmail.com': 0.36; 'why': 0.37; 'ones': 0.37; 'received:209': 0.37; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'header:Received:5': 0.40; 'link': 0.60; 'skip:6 10': 0.63 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :x-enigmail-version:content-type:content-transfer-encoding; bh=50aenJppPwzULE8cjfo9dtzuhfZW5GHMOAU9cvqWHBM=; b=nByIxc4BbXiyeZu3ER38K8W38npju86YyeFjT1b6Ns2enC9mLHqlWiXBNHzp55F62i SJap7zTKQfMLkuPKlrd3CpUFyKTCVXz3s8SCnxbiuPs2ckXBc+c7IC4ENhs5V4pFrYI0 vBJUX8X+tFiQcCKh4roXtDKC+wO1pHIkrlSBMJ7n0v+LOjRKqik7CtTsCsovBHlV52kc YiawKXKdSXZI4RgrTVHCKN/n8NS+sGkx5NRqc1Bfu6o6vxAbTx65LWCqQ060acTYTudZ SWp1n+c+iMBqngAmGH0q8J2mc3S1qvM2+VTi9m/XmissQmF4Zig0N/VPJGIrtivXB9J4 GN8g== Date: Sun, 15 Jul 2012 03:34:46 -0500 From: Andrew Berg User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: "comp.lang.python" Subject: Implicit conversion to boolean in if and while statements X-Enigmail-Version: 1.4.3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1342341291 news.xs4all.nl 6963 [2001:888:2000:d::a6]:38167 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25341 This has probably been discussed before, but why is there an implicit conversion to a boolean in if and while statements? if not None: print('hi') prints 'hi' since bool(None) is False. If this was discussed in a PEP, I would like a link to it. There are so many PEPs, and I wouldn't know which ones to look through. Converting 0 and 1 to False and True seems reasonable, but I don't see the point in converting other arbitrary values. -- CPython 3.3.0b1 | Windows NT 6.1.7601.17803