Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #30854
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <cameron@cskk.homeip.net> |
| 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; '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 <cs@zip.com.au> |
| To | Evan Driscoll <driscoll@cs.wisc.edu> |
| Subject | Re: + in regular expression |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| In-Reply-To | <506EFC44.40508@cs.wisc.edu> |
| User-Agent | Mutt/1.5.21 (2010-09-15) |
| References | <506EFC44.40508@cs.wisc.edu> |
| Cc | python-list@python.org |
| 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.1884.1349480266.27098.python-list@python.org> (permalink) |
| 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 | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:30854 |
Show key headers only | View raw
On 05Oct2012 10:27, Evan Driscoll <driscoll@cs.wisc.edu> 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 <cs@zip.com.au>
The most annoying thing about being without my files after our disc crash was
discovering once again how widespread BLINK was on the web.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: + in regular expression Cameron Simpson <cs@zip.com.au> - 2012-10-06 09:37 +1000 Re: + in regular expression Duncan Booth <duncan.booth@invalid.invalid> - 2012-10-09 11:29 +0000
csiph-web