Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; "subject:' ": 0.07; 'false.': 0.09; 'implements': 0.09; 'method,': 0.09; 'python': 0.11; 'determines': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'length.': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'user-defined': 0.16; 'wrote:': 0.18; "python's": 0.19; 'unlike': 0.19; 'header:User-Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; "d'aprano": 0.31; 'steven': 0.31; 'quite': 0.32; 'fri,': 0.33; 'skip:_ 10': 0.34; 'subject:with': 0.35; 'beyond': 0.35; 'received:84': 0.35; 'method': 0.36; 'to:addr:python-list': 0.38; 'that,': 0.38; 'though,': 0.39; 'to:addr:python.org': 0.39; 'header:Reply-To:1': 0.67; 'nobody': 0.68; 'reply-to:no real name:2**0': 0.71; 'reply- to:addr:python.org': 0.84; '2013': 0.98 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=RZapVTdv c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=oyR3mlnJdzkA:10 a=FBuLjTwyfbYA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=oXw8JkBlnBUA:10 a=vxKEZ1IqyfPLZLX1xdwA:9 a=wPNLvfGTeEIA:10 X-AUTH: mrabarnett:2500 Date: Sat, 15 Jun 2013 01:26:42 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Eval of expr with 'or' and 'and' within References: <51bb4986$0$29997$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: python-list@python.org 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: 11 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1371255992 news.xs4all.nl 15870 [2001:888:2000:d::a6]:35917 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:48232 On 15/06/2013 00:06, Nobody wrote: > On Fri, 14 Jun 2013 16:49:11 +0000, Steven D'Aprano wrote: > >> Unlike Javascript though, Python's idea of truthy and falsey is actually >> quite consistent: > > Beyond that, if a user-defined type implements a __nonzero__() method then > it determines whether an instance is true or false. If it implements a > __len__() method, then an instance is true if it has a non-zero length. > It's __nonzero__ in Python 2, __bool__ in Python 3.