Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #74341
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.021 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; '"("': 0.09; 'append': 0.09; 'integers': 0.09; 'iterate': 0.09; 'literal': 0.09; 'subject:How': 0.10; 'cc:addr:python-list': 0.11; 'python': 0.11; '")"': 0.16; '-tkc': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'readable': 0.16; 'roy': 0.16; 'two.': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'machine': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'characters': 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'fri,': 0.33; 'comment': 0.34; 'subject:the': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'two': 0.37; 'list': 0.37; 'pm,': 0.38; 'little': 0.38; 'skip:u 10': 0.60; 'expression': 0.60; 'first': 0.61; 'skip:n 10': 0.64; 'more': 0.64; 'between': 0.67; 'close': 0.67; 'smith': 0.68; 'jul': 0.74; 'power': 0.76; 'commenting': 0.84; 'capture': 0.91; 'to:none': 0.92 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=rHghkEyxHGabtp6HdzOdTgLUkiNRrrCfdWAVPDR5GwQ=; b=C4kRmE3octE1VoRXH8hcW4byqWdXuJ+cbo4I0kp0/wbD5gdayDJ9GTXPWFJkPJDV0N qzOOiy2paRnX3hGfwWPA3xQz7AbboX7MSnt6JcMya+EQO7Z256ZcbQ61GIYNfzgrHhXa xQ0+Jq1fpBqevUSYpo0gYFkPaLKuZ2nBi4fTulwJNqae1o8IHRjxAfYkTpqP2kKclPMb euUd1hZHBVRj5sip/3uolqfm+6zxUcf247esqnAmjIIYA6vDVI9UAEkUl2V90ahpJ7Po V8xNfS1c4CY/tXwia6qm4/H7SQzu3/a7YG1ZkW6ElhMo0BGb1rwfTnnkgqfeyg/326io cs3Q== |
| MIME-Version | 1.0 |
| X-Received | by 10.52.249.9 with SMTP id yq9mr29207964vdc.6.1405053085238; Thu, 10 Jul 2014 21:31:25 -0700 (PDT) |
| In-Reply-To | <roy-AAB0F1.23332710072014@news.panix.com> |
| References | <981c1f5f-2c19-4efc-8397-796bde07f39b@googlegroups.com> <mailman.11746.1405042179.18130.python-list@python.org> <roy-CC0052.22182710072014@news.panix.com> <mailman.11747.1405046292.18130.python-list@python.org> <roy-AAB0F1.23332710072014@news.panix.com> |
| Date | Fri, 11 Jul 2014 14:31:25 +1000 |
| Subject | Re: How to decipher :re.split(r"(\(\([^)]+\)\))" in the example |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.11748.1405053093.18130.python-list@python.org> (permalink) |
| Lines | 26 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1405053093 news.xs4all.nl 2878 [2001:888:2000:d::a6]:57807 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:74341 |
Show key headers only | View raw
On Fri, Jul 11, 2014 at 1:33 PM, Roy Smith <roy@panix.com> wrote:
>> Or heck, use a multi-line verbose expression and comment it for
>> clarity:
>>
>> r = re.compile(r"""
>> ( # begin a capture group
>> \({2} # two literal "(" characters
>> [^)]+ # one or more non-close-paren characters
>> \){2} # two literal ")" characters
>> ) # close the capture group
>> """, re.VERBOSE)
>>
>> -tkc
>
> Ugh. That reminds me of the classic commenting anti-pattern:
>
> l = [] # create an empty list
> for i in range(10): # iterate over the first 10 integers
> l.append(i) # append each one to the list
Small difference between the two. Python is designed to be a readable
language... regexps combine all the power and unreadability of machine
code with the portability of machine code.
ChrisA
exaggerating... but only a little
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to decipher :re.split(r"(\(\([^)]+\)\))" in the example fl <rxjwg98@gmail.com> - 2014-07-10 08:37 -0700
Re: How to decipher :re.split(r"(\(\([^)]+\)\))" in the example Peter Otten <__peter__@web.de> - 2014-07-10 18:49 +0200
Re: How to decipher :re.split(r"(\(\([^)]+\)\))" in the example MRAB <python@mrabarnett.plus.com> - 2014-07-10 18:01 +0100
Re: How to decipher :re.split(r"(\(\([^)]+\)\))" in the example Joel Goldstick <joel.goldstick@gmail.com> - 2014-07-10 13:05 -0400
Re: How to decipher :re.split(r"(\(\([^)]+\)\))" in the example Albert-Jan Roskam <fomcl@yahoo.com> - 2014-07-10 12:15 -0700
Re: How to decipher :re.split(r"(\(\([^)]+\)\))" in the example Cameron Simpson <cs@zip.com.au> - 2014-07-11 11:29 +1000
Re: How to decipher :re.split(r"(\(\([^)]+\)\))" in the example Roy Smith <roy@panix.com> - 2014-07-10 22:18 -0400
Re: How to decipher :re.split(r"(\(\([^)]+\)\))" in the example Tim Chase <python.list@tim.thechases.com> - 2014-07-10 21:37 -0500
Re: How to decipher :re.split(r"(\(\([^)]+\)\))" in the example Roy Smith <roy@panix.com> - 2014-07-10 23:33 -0400
Re: How to decipher :re.split(r"(\(\([^)]+\)\))" in the example Chris Angelico <rosuav@gmail.com> - 2014-07-11 14:31 +1000
Re: How to decipher :re.split(r"(\(\([^)]+\)\))" in the example alister <alister.nospam.ware@ntlworld.com> - 2014-07-11 08:00 +0000
Re: How to decipher :re.split(r"(\(\([^)]+\)\))" in the example Steven D'Aprano <steve@pearwood.info> - 2014-07-11 09:04 +0000
Re: How to decipher :re.split(r"(\(\([^)]+\)\))" in the example Albert-Jan Roskam <fomcl@yahoo.com> - 2014-07-11 08:18 -0700
csiph-web