Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'python,': 0.02; 'charset:iso-8859-7': 0.04; 'mrab': 0.05; 'sentence': 0.09; 'true)': 0.09; 'works.': 0.09; '6:00': 0.16; 'behave': 0.16; 'docs.': 0.16; 'evaluates': 0.16; 'expecting': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'magic': 0.16; 'operator.': 0.16; 'parentheses': 0.16; 'all.': 0.16; 'wrote:': 0.18; 'result.': 0.19; 'thu,': 0.19; '>>>': 0.22; 'this?': 0.23; 'looks': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; '13,': 0.31; 'sense': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'read': 0.60; 'expression': 0.60; 'first': 0.61; 'name': 0.63; 'subject:gets': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=ARaHAMkVBlhuwM4GaIzPwdqbDnH1zB7tH9laa2lFx84=; b=wEVOyPGMuPEdTIkc5q+LIqN5vnTtMrER86FBdLw4idcndk+yl6rN1ZLBkThS0o3gRc tn+1Xswec+9QZRULDYIzZzcpGquWcBZeqd1v6i1J6KCSXpNpB8YKfGMIk/r+yF+YWfre 31SnBfcFGbQC7K2cbXRnee/cRss3h39OkuJHjoSyar3fvEOqXnCh+msSL5XeDyx2rktZ TT/WwLTsJbt3zF7jOvFLxupeqbR+fnt1yqNqrWoYZfiYTgmBwdR1VWh+1kGr+hYUnJJh YYnG9Pw1d1ZmsCMcY3KVAJeImrtIpNxrLKNIPT7CqFz6ei0IOae1Tz+BK36h8cCJoEVd Ghxw== MIME-Version: 1.0 X-Received: by 10.58.255.199 with SMTP id as7mr10373356ved.23.1371068204784; Wed, 12 Jun 2013 13:16:44 -0700 (PDT) In-Reply-To: References: <2bc90d3b-09c2-4315-9357-ff7f039465e0@googlegroups.com> Date: Thu, 13 Jun 2013 06:16:44 +1000 Subject: Re: A certainl part of an if() structure never gets executed. From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-7 Content-Transfer-Encoding: quoted-printable 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: 39 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1371068212 news.xs4all.nl 15932 [2001:888:2000:d::a6]:37646 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:47840 On Thu, Jun 13, 2013 at 6:00 AM, =CD=E9=EA=FC=EB=E1=EF=F2 =CA=EF=FD=F1=E1= =F2 wrote: > On 12/6/2013 10:48 =EC=EC, Sibylle Koczian wrote: >>> >>> if '=3D' not in ( name and month and year ): >>> i understand: if '=3D' not in name AND '=3D' not in month AND '=3D' not= in year >>> >> Wrong. The "'=3D' not in (...)" first evaluates the expression in >> parentheses, that's what parentheses are for. And then it looks for '=3D= ' >> 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 ) =3D ( name=3DTrue and month=3DTrue and year= =3DTrue ) > > then if '=3D' not in (name =3D True and month =3D True and year =3D True) > > I still do not follow how this works. it just doesn't make any sense to m= e > at all. > > > > if '=3D' not in ( name and month and year ): > if '=3D' not in ( name or month or year ): > > I try to read both of them them as an English sentence but i cannot. > how can you be able to understand this? Go read the docs. In Python, 'in' is an operator. It behaves like an operator. It does not behave like magic. Stop expecting magic of Python. ChrisA