Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news.wiretrip.org!newsfeed.xs4all.nl!newsfeed5.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.01; 'python:': 0.05; 'returned.': 0.07; 'from:addr:python': 0.09; '>>>': 0.12; 'wrote:': 0.14; '"none': 0.16; '(empty': 0.16; '*x*': 0.16; '*x*;': 0.16; '*y*': 0.16; '``x': 0.16; 'containers': 0.16; 'evaluates': 0.16; 'false)': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'non-empty': 0.16; 'received:84.92': 0.16; 'received:84.92.122': 0.16; 'received:84.92.122.60': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'reply-to:addr:python-list': 0.16; 'returned;': 0.16; 'subject:iterable': 0.16; 'subject:required': 0.16; 'y``': 0.16; 'simpler': 0.19; 'true,': 0.19; 'otherwise,': 0.20; 'header:In-Reply-To:1': 0.22; 'numbers.': 0.23; 'received:84': 0.25; 'convention': 0.29; 'none,': 0.31; 'strings,': 0.31; 'zero.': 0.31; 'does': 0.31; 'to:addr:python- list': 0.32; 'expression': 0.33; 'skip:\xce 10': 0.33; 'things': 0.33; 'certain': 0.34; 'describe': 0.35; 'returned': 0.35; 'header :User-Agent:1': 0.35; 'reply-to:addr:python.org': 0.35; 'list,': 0.36; 'none': 0.36; 'else': 0.37; 'resulting': 0.38; 'end': 0.39; 'to:addr:python.org': 0.39; 'how': 0.39; 'empty': 0.40; 'include': 0.40; 'would': 0.40; '8bit%:100': 0.67; 'reply-to:no real name:2**0': 0.72; 'header:Reply-To:1': 0.72; "'true'": 0.84; 'doubt,': 0.84; 'regarded': 0.84 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtcHABzCnE1UXebj/2dsb2JhbACESpQmjQ13iHmqApB5gSiDTHgEkR8 Date: Wed, 06 Apr 2011 20:44:30 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 To: python-list@python.org Subject: Re: TypeError: iterable argument required References: <0ad45930-e3aa-4ad9-a085-49a2d7ddaa1f@s3g2000vbf.googlegroups.com> In-Reply-To: <0ad45930-e3aa-4ad9-a085-49a2d7ddaa1f@s3g2000vbf.googlegroups.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 43 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1302119066 news.xs4all.nl 41113 [::ffff:82.94.164.166]:50103 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:2717 On 06/04/2011 20:21, Νικόλαος Κούρας wrote: > On 6 Απρ, 19:58, "eryksun ()" wrote: > >> The expression ``x or y`` first evaluates *x*; if *x* is >> true, its value is returned; otherwise, *y* is evaluated >> and the resulting value is returned. > > I doesnt matter if *y* is True or False before its value is returned? > *y*'s value returned no matter if its true or false? > > If we were to describe it in english words how would we describe the > expression `x or y`? > x = True or y = True? > >> Since 'mail is None' and None evaluates to False > > What does the expression "None evaluates to false" mean in simpler > words? > Every expression is evaluated at the end as True or False? For `x or y`, if `bool(x)` is True, it returns `x`, else it returns `y`. For `x or y or z`, if `bool(x)` is True, it returns `x`, else if `bool(y)` is True, it returns `y`, else it returns `z`. And so on. In Python, the convention is for certain things to be regarded as False (bool(thing) returns False) and everything else to be regarded as True (bool(thing) returns True). 'False' things include None, empty strings, empty containers (empty list, etc), and zero. 'True' things include non-empty strings, non-empty containers, and non-zero numbers. When in doubt, ask Python: >>> bool([]) False >>> bool("Hello world!") True