Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!dedekind.zen.co.uk!zen.net.uk!hamilton.zen.co.uk!reader01.nrc01.news.zen.net.uk.POSTED!not-for-mail From: Nobody Subject: Re: Eval of expr with 'or' and 'and' within Date: Sat, 15 Jun 2013 00:06:41 +0100 User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Message-Id: Newsgroups: comp.lang.python References: <51bb4986$0$29997$c3e8da3$5496439d@news.astraweb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lines: 9 Organization: Zen Internet NNTP-Posting-Host: 00d010a5.news.zen.co.uk X-Trace: DXC=4^5P`k11aX1gi@@h3C?Zj7a0UP_O8AJo<=dR0\ckLKG0WeZ<[7LZNR6OfK`7^BYPh?M2Z^cWRFGA;jP?oE5Sich8 X-Complaints-To: abuse@zen.co.uk Xref: csiph.com comp.lang.python:48222 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.