Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #33649
| 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 | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.019 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; '#if': 0.05; 'clause': 0.07; 'executed': 0.07; 'python': 0.09; 'both.': 0.16; 'made-up': 0.16; 're.search(': 0.16; 'subject:fails': 0.16; 'subject:when': 0.16; 'wrote:': 0.17; 'kevin': 0.23; 'tried': 0.25; 'header:In- Reply-To:1': 0.25; 'values': 0.26; '2.3': 0.27; 'message- id:@mail.gmail.com': 0.27; 'subject:/': 0.28; 'testing.': 0.29; "skip:' 20": 0.32; 'print': 0.32; 'to:addr:python-list': 0.33; 'version': 0.34; 'received:google.com': 0.34; 'nov': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; '20,': 0.65; 'fortunately,': 0.84; 'subject:else': 0.84; 'to:name:python': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=JNsISSGc4+p5uZKqXSit0JXPzh95xOkIVscbOupbhm0=; b=MLjX+9V2AovQEyy+Z6t58N8egbVbx2S2WiHdxGn9vwsB9+WyDAgMfSA48p4SKhOqJw /n7mE0Eyb/uAhPUyITC/qogs2DcFv1ivN3IgklfhEagqDAyE3Ilar5953ha3LQaxR+Zo Ol5HUN2X89Si6XjqfpWdPwnURm0yW9bAaE0fBvA+3nh4UKrqIXh7OefiQROLrgeOoGjK Dy2IPYGonVjaMQUN1Cut3Y+sq6nFMD3wDRCGg8Ww3px8hR/PM8QnEX4LXhYa0TZuVGBE VD8W8psHORhO4KZiXVGqsVAKz0dhCxyGd1sL+BPGvl85ISJlG7iQOouXogcIDILYpbIO CP+Q== |
| MIME-Version | 1.0 |
| In-Reply-To | <a14abf7d-b231-4cf5-989a-f38e6307867d@googlegroups.com> |
| References | <f0f27287-17ea-4fa5-ad26-ad2b6d3c0031@googlegroups.com> <50aadbe6$0$29983$c3e8da3$5496439d@news.astraweb.com> <50aadcf0$0$29983$c3e8da3$5496439d@news.astraweb.com> <a14abf7d-b231-4cf5-989a-f38e6307867d@googlegroups.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Tue, 20 Nov 2012 12:37:01 -0700 |
| Subject | Re: re.search when used within an if/else fails |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.82.1353440253.29569.python-list@python.org> (permalink) |
| Lines | 18 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1353440253 news.xs4all.nl 6844 [2001:888:2000:d::a6]:54446 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:33649 |
Show key headers only | View raw
On Tue, Nov 20, 2012 at 12:09 PM, Kevin T <kevinintx@gmail.com> wrote:
> #if re.search( "rsrvd", sigName ) : #version a
> #if re.search( "rsrvd", sigName ) == None : #version b
> if re.search( "rsrvd", sigName ) is None : #version bb
> print sigName
> newVal = "%s%s" % ('1'*signal['bits'] , newVal )
> #else: #version c
> if re.search( "rsrvd", sigName ) != None : #version d
> print sigName
> newVal = "%s%s" % ( '0'*signal['bits'],> newVal )
>
> i can use either version a/b the else clause (version c) will not execute.
> fortunately, with version bb, the else clause will execute!!
There must be some other difference in your testing. I don't have
Python 2.4 available, but I tried your version a in both Python 2.3
and 2.5 using made-up values for sigName, and the else clause is
executed in both.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
re.search when used within an if/else fails Kevin T <kevinintx@gmail.com> - 2012-11-19 15:43 -0800
Re: re.search when used within an if/else fails MRAB <python@mrabarnett.plus.com> - 2012-11-20 01:21 +0000
Re: re.search when used within an if/else fails Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-20 01:24 +0000
Re: re.search when used within an if/else fails Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-20 01:29 +0000
Re: re.search when used within an if/else fails Kevin T <kevinintx@gmail.com> - 2012-11-20 11:09 -0800
Re: re.search when used within an if/else fails Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-20 12:37 -0700
Re: re.search when used within an if/else fails Kevin T <kevinintx@gmail.com> - 2012-11-21 08:41 -0800
Re: re.search when used within an if/else fails Chris Angelico <rosuav@gmail.com> - 2012-11-22 16:00 +1100
Re: re.search when used within an if/else fails Kevin T <kevinintx@gmail.com> - 2012-11-28 11:39 -0800
Re: Re: re.search when used within an if/else fails Evan Driscoll <driscoll@cs.wisc.edu> - 2012-11-28 14:08 -0600
Re: re.search when used within an if/else fails Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-28 21:39 +0000
Re: re.search when used within an if/else fails Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-11-28 19:20 -0500
Re: re.search when used within an if/else fails Duncan Booth <duncan.booth@invalid.invalid> - 2012-11-29 09:34 +0000
Re: re.search when used within an if/else fails Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-11-29 13:38 -0500
RE: re.search when used within an if/else fails "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-29 22:57 +0000
RE: re.search when used within an if/else fails "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-29 22:53 +0000
Re: re.search when used within an if/else fails Kevin T <kevinintx@gmail.com> - 2012-11-28 11:39 -0800
Re: re.search when used within an if/else fails Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-28 20:50 +0000
Re: re.search when used within an if/else fails Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-20 12:39 -0700
csiph-web