[Python-ideas] string.replace should accept a list as a first argument

MRAB python at mrabarnett.plus.com
Wed Oct 7 03:05:42 CEST 2015


On 2015-10-07 01:59, Chris Angelico wrote:
> On Wed, Oct 7, 2015 at 11:49 AM, Random832 <random832 at fastmail.com> wrote:
>> Not sure how to get around that, other than by creating a general
>> "structured regex" module, to build a compiled regex from an abstract
>> regex syntax tree rather than a string. Which actually might not be the
>> worst thing in the world. I think there are some Lisp dialects that have
>> something like that.
>
> Ooh, I like this idea. Kinda like the difference between building up
> an SQL statement by escaping all your input, and using a parameterized
> statement.
>
There's always this:

https://pypi.python.org/pypi/regex

Look at "Named lists". ;-)



More information about the Python-ideas mailing list