Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #61419
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!news.mixmin.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.osn.de!diablo2.news.osn.de!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'string.': 0.05; 'subject:PEP': 0.07; 'users,': 0.07; 'if,': 0.09; 'pep': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'jan': 0.12; '"hello': 0.16; 'collins': 0.16; 'iterable': 0.16; 'name)': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'wrote:': 0.18; 'discussion': 0.18; 'library': 0.18; '>>>': 0.22; 'import': 0.22; 'issue.': 0.22; 'header:User- Agent:1': 0.23; 'propose': 0.24; '(or': 0.24; 'tracker': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'needed.': 0.30; "skip:' 10": 0.31; 'proposing': 0.31; 'work:': 0.31; 'text': 0.33; 'checking': 0.33; 'skip:u 20': 0.35; 'something': 0.35; 'no,': 0.35; 'wrong': 0.37; 'so,': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'users': 0.40; 'received:173': 0.61; 'name': 0.63; 'such': 0.63; 'here': 0.66; 'received:fios.verizon.net': 0.84; 'subject:Possible': 0.84; 'approach.': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Terry Reedy <tjreedy@udel.edu> |
| Subject | Re: Possible PEP Submission |
| Date | Mon, 09 Dec 2013 16:59:48 -0500 |
| References | <CAJ=TTfA3qpYtw-ix-MU_0tOy5jxYanTjJoEURGiau=sUiYL1XQ@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | pool-173-75-254-207.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 |
| In-Reply-To | <CAJ=TTfA3qpYtw-ix-MU_0tOy5jxYanTjJoEURGiau=sUiYL1XQ@mail.gmail.com> |
| 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.3800.1386626405.18130.python-list@python.org> (permalink) |
| Lines | 37 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1386626405 news.xs4all.nl 2871 [2001:888:2000:d::a6]:50387 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:61419 |
Show key headers only | View raw
On 12/9/2013 3:36 PM, Logan Collins wrote:
> Just checking whether 1) a PEP is the proper place for this
No, not needed. If, after discussion here (or python-ideas), such a
change would only need a tracker issue.
> and 2) what y'all think about it.
> I would like to propose a change to the the 're' standard library to
> support iterables.
Not really. You are proposing that re.sub accept an iterable of strings
for the replacement string.
> So, something like the following would work:
>
> import re
> text = """hello user
> hello user
> hello user"""
Repeating the text is the wrong approach. So is using re when not needed.
> users = ["Bob", "Alice", "Jeffery"]
>
> newtext = re.sub("user", users, text)
>
> # newtext = "hello Bob\nhello Alice\nhello Jeffery"
>>> '\n'.join('Hello user'.replace('user', name) for name in ["Bob",
"Alice", "Jeffery"])
'Hello Bob\nHello Alice\nHello Jeffery'
--
Terry Jan Reedy
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Possible PEP Submission Terry Reedy <tjreedy@udel.edu> - 2013-12-09 16:59 -0500
csiph-web