Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #34044

Re: re.search when used within an if/else fails

Path csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'say,': 0.05; 'python': 0.09; 'correct,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'tab': 0.09; 'driscoll': 0.16; 'indent': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'space)': 0.16; 'subject:fails': 0.16; 'subject:when': 0.16; 'tab,': 0.16; 'tabs': 0.16; 'true:': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'expanded': 0.17; 'input': 0.18; '(or': 0.18; '"",': 0.22; '3.x': 0.22; 'second': 0.24; 'testing': 0.24; 'pass': 0.25; 'least': 0.25; 'header:X-Complaints-To:1': 0.28; 'subject:/': 0.28; 'concern': 0.29; "d'aprano": 0.29; 'indentation': 0.29; 'spaces': 0.29; 'steven': 0.29; 'source': 0.29; 'file': 0.32; 'not.': 0.32; 'mixed': 0.33; 'url:home': 0.33; 'to:addr:python- list': 0.33; 'text': 0.34; 'third': 0.34; 'fail': 0.35; 'nov': 0.35; 'there': 0.35; 'next': 0.35; 'received:org': 0.36; 'but': 0.36; 'anything': 0.36; 'test': 0.36; 'should': 0.36; 'charset:us- ascii': 0.36; 'editor': 0.37; 'does': 0.37; 'level': 0.37; 'two': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'space': 0.39; 'header:Received:5': 0.40; 'think': 0.40; 'first': 0.61; 'show': 0.63; 'confirm': 0.64; 'due': 0.66; 'believe': 0.69; 'eight': 0.71; 'fourth': 0.84; 'subject:else': 0.84; 'visually': 0.84; 'dennis': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: re.search when used within an if/else fails
Date Wed, 28 Nov 2012 19:20:35 -0500
Organization > Bestiaria Support Staff <
References <a14abf7d-b231-4cf5-989a-f38e6307867d@googlegroups.com> <mailman.82.1353440253.29569.python-list@python.org> <2930dc36-9d8f-411d-aa7a-272fe4885ec5@i5g2000yqh.googlegroups.com> <mailman.192.1353560449.29569.python-list@python.org> <11835b30-3448-45cc-9ae5-46d651f93429@googlegroups.com> <CALwzid=MW+c2F_Z_2=npC=Z41FJuFOXYMBJ0N-fGxycJE53t4A@mail.gmail.com> <mailman.346.1354133357.29569.python-list@python.org> <50b68476$0$29994$c3e8da3$5496439d@news.astraweb.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host adsl-76-253-108-151.dsl.klmzmi.sbcglobal.net
X-Newsreader Forte Agent 3.3/32.846
X-No-Archive YES
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.352.1354148444.29569.python-list@python.org> (permalink)
Lines 54
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1354148444 news.xs4all.nl 6852 [2001:888:2000:d::a6]:41168
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:34044

Show key headers only | View raw


On 28 Nov 2012 21:39:03 GMT, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> declaimed the following in
gmane.comp.python.general:

> On Wed, 28 Nov 2012 14:08:15 -0600, Evan Driscoll wrote:
> 
> > to go test it, I think that if you, say, indent from the first to the
> > second level with tabs (consistently), indent from the second to third
> > level with spaces (consistently), and indent from the third to fourth
> > level with tabs (consistently), it should not complain. 
> 
> Correct, which disappoints me. Testing with Python 3:
> 
> py> if True:
> ...     if True: # tab
> ...         pass  # tab, then four spaces
> ...
> py>
> 
> I would prefer that the "pass" line would fail with an illegal indent, 
> but it does not. But at least the following fails cleanly:
> 
> 
> py> if True:
> ...     if True: # tab
> ...         pass  # tab, then four spaces
> ...         pass  # two spaces, tab, four spaces
>   File "<stdin>", line 4
>     pass  # two spaces, tab, four spaces
>                                        ^
> TabError: inconsistent use of tabs and spaces in indentation
>

	Unless there has been a major change in the parser... (I still don't
have Python 3.x installed)

	I believe <tab> is expanded to 8-spaces -- NOT TO NEXT MULTIPLE OF
8...

	So the first is 8+4 => 12 spaces, the second is 2+8+4 => 14 spaces.

	Does 2 + <tab> + 2 vs 4 + <tab> vs <tab> + 4 succeed? That would
confirm the treatment. 

	The main concern with mixed tab and spaces, as I recall, was due to
having /editors/ and /terminals/ configured to show <tab> as a four
space (or anything other than an eight space) increment; so visually
four spaces and one <tab> might look the same... One user might have the
editor showing 4-space indents on <tab> but entering text using 4 spaces
on input -- which now is mis-aligned if the source file HAD <tab> in it.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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