Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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.055 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; 'modified': 0.07; 'subject:PEP': 0.07; 'users,': 0.07; 'pep': 0.09; '"hello': 0.16; 'collins': 0.16; 'gpg': 0.16; 'think?': 0.16; 'url:get': 0.16; 'library': 0.18; 'import': 0.22; 'propose': 0.24; 'certain': 0.27; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'work:': 0.31; 'text': 0.33; 'cases': 0.33; 'checking': 0.33; 'entirely': 0.33; 'url:non-standard http port': 0.33; 'skip:u 20': 0.35; 'something': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'should': 0.36; 'so,': 0.37; 'skip:& 10': 0.38; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'skip:& 20': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'users': 0.40; 'new': 0.61; 'url:search': 0.81; 'subject:Possible': 0.84; 'url:11371': 0.91; 'url:lookup': 0.91; 'url:op': 0.91; 'url:pks': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=tZ+ON7JX5LtkDUXccZN1H3xZfDTEzAlRdFzhpLA1Jqc=; b=CWko04YtRkl8QFUAUYfwjUJOPwPEUTNrY2XKkULRrD3RXDNBFkt+7pdqg0pR34CYKt xIgkNnN8GuineQCdSusArUxEJw8mKZaO5pte0f6+5f0YSoxk6Z3OGbOQ1Jsvc5vw5qoA bkrBxx/W1Aq26bFOFN22V/elCLnc1S+SU8X31ibbHN77uVz00dbqAetO/b00D1vt/Kg6 CoXWAV1HEI1dGveN/lF95NgGUiZ+HxjAxG0hF/GQjz6JEXB42hv14i8j31uNXppSdgCr lnvNzDr1XQKA5kmDlSm9GdjosbGeCQmscQ4HGOIGsp7OSMYKdCLH5OkVZdwuMVrhmv87 iWaA== X-Received: by 10.60.125.68 with SMTP id mo4mr13846766oeb.40.1386621397873; Mon, 09 Dec 2013 12:36:37 -0800 (PST) MIME-Version: 1.0 From: Logan Collins Date: Mon, 9 Dec 2013 14:36:17 -0600 Subject: Possible PEP Submission To: python-list@python.org Content-Type: multipart/alternative; boundary=047d7b2ee6d9dbbe4604ed1ff31a 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: 63 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1386621408 news.xs4all.nl 2900 [2001:888:2000:d::a6]:49344 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:61411 --047d7b2ee6d9dbbe4604ed1ff31a Content-Type: text/plain; charset=ISO-8859-1 Just checking whether 1) a PEP is the proper place for this and 2) what y'all think about it. I would like to propose a change to the the 're' standard library to support iterables. So, something like the following would work: import re text = """hello user hello user hello user""" users = ["Bob", "Alice", "Jeffery"] newtext = re.sub("user", users, text) # newtext = "hello Bob\nhello Alice\nhello Jeffery" There are a few corner cases I'm not sure what would be the best behavior. Nor am I entirely certain this should be modified functionality or just... a new function. What do y'all think? -- ---Logan Collins GPG Public Key 2AAE8775 0xfc1185c82aae8775 http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0xFC1185C82AAE8775 --047d7b2ee6d9dbbe4604ed1ff31a Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Just checking whether 1) a PEP is the proper place for thi= s and 2) what y'all think about it.

I would like to = propose a change to the the 're' standard library to support iterab= les.

So, something like the following would work:
=
import re
text =3D """hello user
hello user
hello user"""

users =3D ["Bob", "Alice", "Jeffery"]

newtext =3D re.sub("user", users, text)

# newtext =3D "hello Bob\nhello Alice\nhello Je= ffery"

There are a few corner cases I'm not sure what woul= d be the best behavior. Nor am I entirely certain this should be modified f= unctionality or just... a new function. What do y'all think?


--
---Logan Collins

GPG Public Key= 2AAE8775
0xfc1185c82aae8775
http://keyserver.= ubuntu.com:11371/pks/lookup?op=3Dget&search=3D0xFC1185C82AAE8775
--047d7b2ee6d9dbbe4604ed1ff31a--