Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'explicitly': 0.04; 'true,': 0.04; 'objects,': 0.07; 'behavior,': 0.09; 'subject:while': 0.09; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; "isn't.": 0.16; 'wrote:': 0.17; 'pointer': 0.17; 'received:209.85.214.174': 0.21; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'andrew': 0.27; 'object,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'behaviour': 0.29; 'coded': 0.29; "d'aprano": 0.29; 'steven': 0.29; 'null': 0.33; 'to:addr:python- list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'header:Received:5': 0.40; 'more': 0.63; 'jul': 0.65 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=UT9/cijcLOia5Vc4zkiwKeFoQc613Big93iV3KPJsCo=; b=E9KUFwc146V8h2Lz24zaKgRKuGYzE8PNhkUyzGSCa4Ra/XXxGE0AK1YjXHGb1UDhbY kjhA++6Mz6mYMsTZGVOltt3hc88C6eIAx9OmYYb/99PHR2Q30+feYKzPF+Fk1l3+Toh6 wa21eDXxF4PFzm3hloujcJ6tOg2haxlxw4ONx6OPynTVVXp4JOORFgntZOURjpjoAUm7 7y2w0B1kgGi+HjVbHd6gxAx2DXLf58KQj1qNVDu2sw7zmIYZ5Ru+3iZJfVG3Yx47wt9o Fxeoy9BaQEd7iLJVs/4klloh1rWoNCWlf0nUIN01KCtNKCXpODAe9uF2t7aSBdFx0hx9 xLQQ== MIME-Version: 1.0 In-Reply-To: <500520FF.3010305@gmail.com> References: <5002a1f9$0$29995$c3e8da3$5496439d@news.astraweb.com> <50037eab$0$29995$c3e8da3$5496439d@news.astraweb.com> <50047A84.6020208@gmail.com> <5004b543$0$29978$c3e8da3$5496439d@news.astraweb.com> <5004ec84$0$11116$c3e8da3@news.astraweb.com> <50050f70$0$30002$c3e8da3$5496439d@news.astraweb.com> <500520FF.3010305@gmail.com> Date: Tue, 17 Jul 2012 18:32:53 +1000 Subject: Re: Implicit conversion to boolean in if and while statements From: Chris Angelico To: python-list@python.org 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: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1342513982 news.xs4all.nl 6914 [2001:888:2000:d::a6]:60224 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25471 On Tue, Jul 17, 2012 at 6:23 PM, Andrew Berg wrote: > On 7/17/2012 2:08 AM, Steven D'Aprano wrote: >> The default behaviour is that every object is something, hence true-like, >> unless explicitly coded to be treated as false-like. Since both loggers >> and functions are objects, they are true-like unless the default is >> overridden. > I am aware of the default behavior, but the reason for it still eludes me. There has to be something. This way, you can use None in place of any object, in the same way that a null pointer would be used in C; any object is true, None isn't. What other default makes more sense? ChrisA