Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'mrab': 0.05; 'none,': 0.07; 'string': 0.09; 'false,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'language,': 0.12; 'evaluates': 0.16; 'parentheses': 0.16; 'received:80.91.229.3': 0.16; 'received:mnet-online.de': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.18; 'result.': 0.19; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'looks': 0.24; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'character': 0.29; "doesn't": 0.30; 'another': 0.32; 'but': 0.35; 'really': 0.36; 'explains': 0.36; 'searching': 0.37; 'to:addr :python-list': 0.38; "couldn't": 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'read': 0.60; 'expression': 0.60; 'no.': 0.61; 'first': 0.61; 'name': 0.63; '8bit%:92': 0.71; '8bit%:100': 0.72; 'greetings': 0.72; 'evaluate': 0.72; 'received:93': 0.72; 'subject:gets': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Sibylle Koczian Subject: Re: A certainl part of an if() structure never gets executed. Date: Wed, 12 Jun 2013 23:16:13 +0200 References: <2bc90d3b-09c2-4315-9357-ff7f039465e0@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: ppp-93-104-177-249.dynamic.mnet-online.de User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1371071791 news.xs4all.nl 15961 [2001:888:2000:d::a6]:50705 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:47851 Am 12.06.2013 22:00, schrieb Νικόλαος Κούρας: > On 12/6/2013 10:48 μμ, Sibylle Koczian wrote: >>> if '=' not in ( name and month and year ): >>> i understand: if '=' not in name AND '=' not in month AND '=' not in >>> year >>> >> Wrong. The "'=' not in (...)" first evaluates the expression in >> parentheses, that's what parentheses are for. And then it looks for '=' >> in the result. And that result is just one of the three values, MRAB >> told you which one. > > okey first the expression eval: > > ( name and month and year ) = ( name=True and month=True and year=True ) > No. Read MRABs post, he explains it. Or work through the tutorial. This would be right in another language, but not in Python. If this expression would really evaluate to True or False, you definitely couldn't search for any character in the result. As it is, it evaluates to a string or to None, but searching for '=' in that string doesn't give the result you think it does. Greetings Sibylle