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: 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 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: <2930dc36-9d8f-411d-aa7a-272fe4885ec5@i5g2000yqh.googlegroups.com> <11835b30-3448-45cc-9ae5-46d651f93429@googlegroups.com> <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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On 28 Nov 2012 21:39:03 GMT, Steven D'Aprano 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 "", 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 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 + + 2 vs 4 + vs + 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 as a four space (or anything other than an eight space) increment; so visually four spaces and one might look the same... One user might have the editor showing 4-space indents on but entering text using 4 spaces on input -- which now is mis-aligned if the source file HAD in it. -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/