Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!xlned.com!feeder5.xlned.com!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.034 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'none,': 0.05; '"if': 0.09; 'semantics': 0.09; 'subject:while': 0.09; 'none"': 0.16; 'record,': 0.16; 'trap': 0.16; 'wrote:': 0.17; '15,': 0.23; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'message- id:@mail.gmail.com': 0.27; "d'aprano": 0.29; 'steven': 0.29; 'objects': 0.29; 'point': 0.31; 'to:addr:python-list': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'false': 0.35; 'received:209.85': 0.35; 'test': 0.36; 'should': 0.36; '(for': 0.37; 'rather': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'think': 0.40; 'ever': 0.63; 'jul': 0.65; '(is': 0.84; 'to:name:python': 0.84 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 :content-type; bh=a2hr0+oxuj+HKeiJsY3b1sV1cQ9iTHcs9kEN1OTAQlI=; b=vH0PCApuBAZIILDyEVim+b1prcGP5lTdMLhMY2pgSLugVyyeGceiD9MT9nnTmJ8sz+ G7U87BOeIWMZz/NJAwU5rYw7eDq7nTVVXSoCcFLBeTYjMbfJMPNieyj8R3vvF3o5C/L2 yHu5kslGgyyq1yg/PG/mll1sIFUL3itKvDbJnrbvw5TkPsLdH1AYKQVxOX3G7YECFHsu AiSv4IRGQ6ZyeVkKlgil1SH7k33mMw+d9QMTQcrFPsig9FQfgpKE77j4vtawMML8/HeG FSOoSWnhLmKgJxZ9zYssxp5bB+RUtvhQXBKGWS3ewA7XrS6YnTaffxG42/mh0R9fmX/h TqgA== MIME-Version: 1.0 In-Reply-To: <5002a1f9$0$29995$c3e8da3$5496439d@news.astraweb.com> References: <5002a1f9$0$29995$c3e8da3$5496439d@news.astraweb.com> From: Ian Kelly Date: Sun, 15 Jul 2012 10:19:16 -0600 Subject: Re: Implicit conversion to boolean in if and while statements To: Python Content-Type: text/plain; charset=ISO-8859-1 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: 9 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1342369188 news.xs4all.nl 6920 [2001:888:2000:d::a6]:34052 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25354 On Sun, Jul 15, 2012 at 4:56 AM, Steven D'Aprano wrote: > (For the record, I can only think of one trap for the unwary: time > objects are false at *exactly* midnight.) Ugh, that's irritating. I can't think of any scenario where I would ever want the semantics "if timeval (is not midnight):". This reinforces the point that if you only want to test whether you have None, you should use "is not None" rather than relying on __bool__.