[Python-ideas] Give regex operations more sugar

Michel Desmoulin desmoulinmichel at gmail.com
Wed Jun 13 09:40:18 EDT 2018


>> I suggest building all regex operations into the str class itself, as well
>> as a new syntax for regular expressions.
> 
>    There are many different regular expression implementation (regex,
> re2). How to make ``s.search(pattern)`` work with all of them?
> 
You don't, they work stand alone anyway. Besides, nobody is proposing to
retire the re module either.

But if it's really important, you can make hooks to provide the
implementation like we did with breakpoint().

I really wish, however, than we separate the issue of adding the methods
on the str object, and making literals.

I know that literals are going to be rejected, "python is not perl", etc.

But the str methods are quite an interesting idea.


More information about the Python-ideas mailing list