Possible PEP Submission

L

Logan Collins

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top