Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed6.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.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'cpython': 0.05; 'e.g.,': 0.07; 'received:209.85.160.174': 0.07; 'subject:while': 0.09; 'sure,': 0.09; 'represents': 0.15; 'distinction': 0.16; 'represents.': 0.16; 'wrote:': 0.17; 'windows': 0.19; 'supposed': 0.21; 'interpret': 0.22; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'important.': 0.27; "d'aprano": 0.29; 'steven': 0.29; 'expect': 0.31; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'stores': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'there': 0.35; 'but': 0.36; 'message-id:@gmail.com': 0.36; 'depends': 0.36; 'should': 0.36; 'quite': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'header:Received:5': 0.40; 'between': 0.63; 'skip:6 10': 0.63; 'total': 0.65 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:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=0GewEm4Ri0z2jm/PM8h/yPt8Q6iukCnlKL0hn6tJEX0=; b=Ijn6b+hOTgqKW3k1QYUQgRRF/8IKzG09dPv3IEldD6O9p8Hq3sYYSKm+FxYzyL8lGA P965+WuqtzxXVDtG6mPjlECwiG7eQCa0YeFyYTllFVQm1Je64iZHEgBCLBIjpX9j8tPL SR+OuAydHCpFuPEkG5Va57yyCVm0evvY/jsB3SGUN4/JmlB/zRrgDkwW49UZLuyyXmlK 7fDcnamRn+D7g+nA2ROZO5/vJFUPplAHT1FcOmbr+pinmh60NSugd9czEV8ZxkK2z5lw BW9a8WElYLT7Sum1Ex2irKlnsdQRpv32aUUZk2arzt688TEDT3Iqb6KHziblFXmplyZM AQJA== Date: Mon, 16 Jul 2012 15:33:08 -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: Re: Implicit conversion to boolean in if and while statements References: <5002a1f9$0$29995$c3e8da3$5496439d@news.astraweb.com> <50037eab$0$29995$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: <50037eab$0$29995$c3e8da3$5496439d@news.astraweb.com> 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: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1342470794 news.xs4all.nl 6866 [2001:888:2000:d::a6]:39555 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25437 On 7/15/2012 9:38 PM, Steven D'Aprano wrote: >> I would expect None to mean "doesn't exist" or "unknown" or >> something like that - e.g., a value of 0 means 0 jelly beans in the jar >> and None means there isn't a jar. > > How you interpret some_variable = None depends on what some_variable > represents. If some_variable represents "number of jelly beans in a jar", > then that should be 0 if there is no jar. What is None supposed to mean then, and what should I do when I have to make a distinction between "doesn't exist" and "empty"? Sure, if I need to count the total number of jelly beans in all my stores, the distinction is meaningless, but if I need to find out which stores sell jelly beans so I know which stores need to be restocked, the distinction is quite important. -- CPython 3.3.0b1 | Windows NT 6.1.7601.17803