Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #102031
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Vlastimil Brom <vlastimil.brom@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: one more question on regex |
| Date | Sat, 23 Jan 2016 11:39:32 +0100 |
| Lines | 32 |
| Message-ID | <mailman.174.1453545581.15297.python-list@python.org> (permalink) |
| References | <n7ti39$7rt$1@gioia.aioe.org> <n7tj3j$9ra$1@gioia.aioe.org> <mailman.173.1453493453.15297.python-list@python.org> <n7ubhk$k9f$1@gioia.aioe.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de kcfOX+F4pbxEw64D2ab3QAci+KgpNFiblWmJwMaPzDcQ== |
| Return-Path | <vlastimil.brom@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.031 |
| X-Spam-Evidence | '*H*': 0.94; '*S*': 0.00; 'resulting': 0.04; 'correct.': 0.07; 'matches': 0.07; 'subject:question': 0.08; 'jan': 0.11; 'user.': 0.15; '2016': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'url:html#re': 0.16; 'documented': 0.18; 'string,': 0.18; 'tests': 0.18; 'tuples': 0.22; 'seems': 0.23; 'header:In-Reply-To:1': 0.24; 'fri,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'behaviour': 0.29; 'robust': 0.29; 'url:mailman': 0.30; 'anyone': 0.32; 'non': 0.32; 'point': 0.33; 'useful': 0.33; 'url:python': 0.33; "i'll": 0.33; 'url:listinfo': 0.34; 'list': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'should': 0.36; 'there': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; '(and': 0.36; 'url:library': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'hi,': 0.38; 'url:mail': 0.40; 'to:addr:python.org': 0.40; 'url:3': 0.60; 'subject:more': 0.61; 'back': 0.62; 'skip:n 10': 0.62; 'more': 0.63; 'information': 0.63; 'account': 0.66; 'results': 0.66; 'special': 0.73; 'to:name:python': 0.84; 'reasoning': 0.91 |
| 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:to :content-type; bh=Fq7VSyJmiLDAuCJWK8WxegEksgb6qZAbes/y6QtsmNM=; b=UKq8KitnaqMr9N+IJf98ZCYADeXUeEBMsauqtc41bpt994ocX/6P+QVCtuf5TnKSKE NOP4gVyniJb7hvjqLlEzEazTE9lu93EzF8Z6uybzsHNfre7yoTuIGJ7ouBjSvsZKjiV0 UhKrkXfn9fKzcMJjSlOtxpovRHpz7mt6lLF2vGd014VFRW+mybfXxsGTkCtlCwPw9FPd hO3cWFVzU2kJ6LMqECIzazjcJK5bwPy1str/+PeJ2wBYDljEKNcgDb1INgLR8hQaFgsy 9UFnljp1ldo8/5V6VHbWA7BUaEjOJLmS2jNm3YftB65Zwm81kZ14iMV+quLMhmLt92Iv 9coA== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=Fq7VSyJmiLDAuCJWK8WxegEksgb6qZAbes/y6QtsmNM=; b=DJ5MQwRLLizIxfl8BUejAn74CRaQmmFrG2sD+hMRhoxpCLYDARkkH1BcMUULQfKHET edHcNoDIvn7x29WDY7HZnjDbpqcln3zq6gVNNKo8oM0fHIcdtiAXH1cqSQbfn7wczhFZ c+GtQPvoPAawbJBvp3FU0O7OPMXLGmcRWE6DnAbNZOMXu21UbCTG+AFHt+8dBpTyfdsi Tf59Is1eCTQHbQb/RDKfRFxHqjCHe127f2K0ZcnYHjFUTNiNFDEzszwLQm/RjBl9bTcH dv1K87T/Rq+iEdnMUvVFdx2LrWUxk2aQqYrPjQAVww0yKWTq6MjUCSxgnv3ERgMaa//q lv+Q== |
| X-Gm-Message-State | AG10YOTAZ8QM7htAFxlmda/rjb5u9QX4OBPMhMq+bqz221oYKM497yBW1UkRSnvUmORSuRj6i6GuTYBrL4H6gg== |
| X-Received | by 10.112.171.4 with SMTP id aq4mr2910634lbc.85.1453545572887; Sat, 23 Jan 2016 02:39:32 -0800 (PST) |
| In-Reply-To | <n7ubhk$k9f$1@gioia.aioe.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| 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> |
| Xref | csiph.com comp.lang.python:102031 |
Show key headers only | View raw
2016-01-22 23:47 GMT+01:00 mg <noOne@nowhere.com>: > Il Fri, 22 Jan 2016 21:10:44 +0100, Vlastimil Brom ha scritto: > >> [...] > > You explanation of re.findall() results is correct. My point is that the > documentation states: > > re.findall(pattern, string, flags=0) > Return all non-overlapping matches of pattern in string, as a list of > strings > > and this is not what re.findall does. IMHO it should be more reasonable > to get back the whole matches, since this seems to me the most useful > information for the user. In any case I'll go with finditer, that returns > in match object all the infos that anyone can look for. > -- > https://mail.python.org/mailman/listinfo/python-list Hi, I don't know the reasoning for this special behaviour of findall, but it seems to be documented explicitly: https://docs.python.org/3/library/re.html#re.findall "... If one or more groups are present in the pattern, return a list of groups; this will be a list of tuples if the pattern has more than one group. finditer is clearly much more robust for general usage. I only use findall for quick one-line tests (and there one has to account for this specificities - either by using non capturing groups or enclosing the whole pattern in a "main" group and use the first items in the resulting tuples. vbr
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
one more question on regex mg <noOne@nowhere.com> - 2016-01-22 15:32 +0000
Re: one more question on regex Peter Otten <__peter__@web.de> - 2016-01-22 16:47 +0100
Re: one more question on regex mg <noOne@nowhere.com> - 2016-01-22 15:50 +0000
Re: one more question on regex Vlastimil Brom <vlastimil.brom@gmail.com> - 2016-01-22 21:10 +0100
Re: one more question on regex mg <noOne@nowhere.com> - 2016-01-22 22:47 +0000
Re: one more question on regex Vlastimil Brom <vlastimil.brom@gmail.com> - 2016-01-23 11:39 +0100
csiph-web