[Python-ideas] Give regex operations more sugar

Rhodri James rhodri at kynesim.co.uk
Wed Jun 13 07:46:35 EDT 2018


On 13/06/18 12:06, Ken Hilton wrote:
> Hi all,
> 
> Regexes are really useful in many places, and to me it's sad to see the
> builtin "re" module having to resort to requiring a source string as an
> argument. It would be much more elegant to simply do "s.search(pattern)"
> than "re.search(pattern, s)".
> I suggest building all regex operations into the str class itself, as well
> as a new syntax for regular expressions.
[snip]
> Thoughts?

My first, most obvious thought is that Python is not Perl, and does not 
encourage people to reach for regular expressions at every opportunity. 
That said, I don't see how having a special delimiter syntax for 
something that could just as well be a string is a help.

-- 
Rhodri James *-* Kynesim Ltd


More information about the Python-ideas mailing list