Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.84.MISMATCH!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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'operator': 0.05; 'python': 0.07; '>>>>': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'wrote:': 0.14; 'explanation': 0.16; 'subject:iterable': 0.16; 'subject:required': 0.16; 'header:In-Reply-To:1': 0.22; 'here?': 0.23; 'behaves': 0.31; 'comparison': 0.31; 'differently': 0.31; 'url:library': 0.31; 'to:addr:python-list': 0.32; 'thank': 0.32; 'url:docs': 0.33; 'skip:\xce 10': 0.33; 'header:X-Complaints- To:1': 0.34; 'header:User-Agent:1': 0.35; 'none': 0.36; 'url:python': 0.37; 'url:org': 0.38; 'received:org': 0.38; 'explain': 0.39; 'to:addr:python.org': 0.39; 'header:Mime- Version:1': 0.39; 'how': 0.39; 'header:Received:5': 0.40; 'you.': 0.61; 'order': 0.61; 'received:89': 0.64; 'truth': 0.65; 'here': 0.65; '8bit%:100': 0.67 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Blockheads Oi Oi Subject: Re: TypeError: iterable argument required Date: Wed, 06 Apr 2011 17:12:29 +0100 References: <27163982-380f-4ddd-859e-adc069892c28@glegroupsg2000goo.googlegroups.com> <899d22f6-c936-4fe6-b824-4d064281ca54@o26g2000vby.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 89.243.203.7 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 In-Reply-To: <899d22f6-c936-4fe6-b824-4d064281ca54@o26g2000vby.googlegroups.com> X-Antivirus: avast! (VPS 110406-0, 06/04/2011), Outbound message X-Antivirus-Status: Clean 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: 40 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1302106359 news.xs4all.nl 81476 [::ffff:82.94.164.166]:34966 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:2708 On 06/04/2011 16:57, Νικόλαος Κούρας wrote: >>>> mail = None >>>> mail = mail or 7 >>>> mail > 7 > >>>> mail = None >>>> mail = 7 or mail >>>> mail > 7 > > Here no matter the order iam writing the comparison it always return > the number. > > why not the same here? > >>>> mail = None >>>> mail = mail or '' >>>> mail > '' > >>>> mail = None >>>> mail = '' or mail >>>> mail >>>> > > Why the or operator behaves differently with numbers than from > strings? > > Please explain to me how it parses it with words. > > Thank you. See this for an explanation of Python truth value testing. http://docs.python.org/library/stdtypes.html Cheers. Mark L.