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; 'e.g.,': 0.07; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'received:184.172': 0.09; 'received:gator410.hostgator.com': 0.09; 'subject:while': 0.09; 'sure,': 0.09; '~ethan~': 0.09; 'represents': 0.15; 'distinction': 0.16; 'received:72.11': 0.16; 'received:72.11.125': 0.16; 'received:72.11.125.166': 0.16; 'represents.': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'trying': 0.21; 'supposed': 0.21; 'interpret': 0.22; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'andrew': 0.27; 'important.': 0.27; "d'aprano": 0.29; 'steven': 0.29; "i'm": 0.29; 'expect': 0.31; 'to:addr:python-list': 0.33; 'stores': 0.35; 'pm,': 0.35; 'something': 0.35; 'there': 0.35; 'but': 0.36; 'depends': 0.36; 'should': 0.36; 'quite': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'sure': 0.38; 'there,': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'between': 0.63; 'total': 0.65; 'received:69.56': 0.65; 'received:69.56.148': 0.84; 'received:69.56.148.22': 0.84 Date: Mon, 16 Jul 2012 13:54:32 -0700 From: Ethan Furman User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) 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> <50047A84.6020208@gmail.com> In-Reply-To: <50047A84.6020208@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator410.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-BWhitelist: no X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([192.168.10.136]) [72.11.125.166]:1499 X-Source-Auth: ethan+stoneleaf.us X-Email-Count: 1 X-Source-Cap: dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ== 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1342471591 news.xs4all.nl 6902 [2001:888:2000:d::a6]:48821 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25439 Andrew Berg wrote: > 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. I'm not sure what Steven was trying to say there, but for me: jar with no jellybeans == 0 no jar == None ~Ethan~