Received: by 10.204.129.9 with SMTP id m9mr6758bks.1.1349940464107; Thu, 11 Oct 2012 00:27:44 -0700 (PDT) Path: q11ni134268755wiw.1!nntp.google.com!feeder3.cambriumusenet.nl!feed.tweaknews.nl!193.141.40.65.MISMATCH!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!border2.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.glorb.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-l...@python.org Delivered-To: python-l...@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'syntax': 0.03; 'patterns': 0.04; 'compiler': 0.05; 'sufficient': 0.05; 'expressions': 0.07; 'parsing': 0.07; 'plenty': 0.07; 'repeated': 0.07; 'python': 0.09; 'finite': 0.09; 'res': 0.09; 'sentence': 0.09; 'cc:addr:python- list': 0.10; '"hey': 0.16; 'constructs': 0.16; 'disc': 0.16; 'driscoll': 0.16; 'emit': 0.16; 'excludes': 0.16; 'exponential': 0.16; 'expressions)': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'occurence': 0.16; 'reason.': 0.16; 'received:202.125.174': 0.16; 'received:202.125.174.133': 0.16; 'received:boardofstudies.nsw.edu.au': 0.16; 'received:cskk.homeip.net': 0.16; 'received:edu.au': 0.16; 'received:harvey.boardofstudies.nsw.edu.au': 0.16; 'received:homeip.net': 0.16; 'received:nsw.edu.au': 0.16; 'simpson': 0.16; 'subject:expression': 0.16; 'subject:regular': 0.16; 'wrote:': 0.17; 'certainly': 0.17; '(in': 0.18; 'supposed': 0.21; 'parse': 0.22; 'recognize': 0.22; 'simpler': 0.22; 'cc:2**0': 0.23; "i've": 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'common': 0.26; 'coding': 0.27; 'converting': 0.27; 'regular': 0.27; 'lines': 0.28; 'actual': 0.28; 'crash': 0.29; 'indentation': 0.29; 'perl': 0.29; 'way?': 0.29; 'workaround': 0.29; 'web.': 0.30; 'error': 0.30; 'could': 0.32; 'languages': 0.33; 'requirements': 0.33; 'requiring': 0.35; 'there': 0.35; 'but': 0.36; 'alone': 0.36; 'received:au': 0.36; "didn't": 0.36; 'charset:us-ascii': 0.36; 'problems': 0.36; 'being': 0.37; 'files': 0.38; 'where': 0.40; 'think': 0.40; 'content-disposition:inline': 0.60; 'skip:u 10': 0.60; 'most': 0.61; 'story': 0.61; 'techniques': 0.63; 'different': 0.63; 'our': 0.65; 'real-world': 0.65; 'cut': 0.71; 'designers': 0.75; 'complaint': 0.84; 'construct': 0.84; 'reveal': 0.84; 'discovering': 0.91; 'mistake': 0.91; 'widespread': 0.91 Date: Sat, 6 Oct 2012 09:37:42 +1000 From: Cameron Simpson To: Evan Driscoll Subject: Re: + in regular expression MIME-Version: 1.0 In-Reply-To: <506EFC44.40...@cs.wisc.edu> User-Agent: Mutt/1.5.21 (2010-09-15) References: <506EFC44.40...@cs.wisc.edu> Cc: python-l...@python.org X-BeenThere: python-l...@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: 40 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1349480266 news.xs4all.nl 6947 [2001:888:2000:d::a6]:37192 X-Complaints-To: ab...@xs4all.nl Bytes: 5359 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On 05Oct2012 10:27, Evan Driscoll wrote: | I can understand that you can create a grammar that excludes it. [...] | Was it because such patterns often reveal a mistake? For myself, I would consider that sufficient reason. I've seen plenty of languages (C and shell, for example, though they are not alone or egrarious) where a compiler can emit a syntax complaint many lines from the actual coding mistake (in shell, an unclosed quote or control construct is a common examplei; Python has the same issue but mitigated by the indentation requirements which cut the occurence down a lot). Forbidding a common error by requiring a wordier workaround isn't unreasonable. | Because "\s{6}+" | has other meanings in different regex syntaxes and the designers didn't | want confusion? I think Python REs are supposed to be Perl compatible; ISTR an opening sentence to that effect... | Because it was simpler to parse that way? Because the | "hey you recognize regular expressions by converting it to a finite | automaton" story is a lie in most real-world regex implementations (in | part because they're not actually regular expressions) and repeated | quantifiers cause problems with the parsing techniques that actually get | used? There are certainly constructs that can cause an exponential amount of backtracking is misused. One could make a case for discouragement (though not a case for forbidding them). Just my 2c, -- Cameron Simpson The most annoying thing about being without my files after our disc crash was discovering once again how widespread BLINK was on the web.