2 ms·
Okay, so that's a somewhat different claim and it really comes down to how much you care about an operator versus a extra couple of characters. Most programmers
by acdha 6y ago
Okay, so that's a somewhat different claim and it really comes down to how much you care about an operator versus a extra couple of characters. Most programmers know how to touch-type and do not hammer out regexps so quickly that the difference between:
$foo =~ s/foo/bar/
and
foo = re.sub("foo", "bar", foo)
is a significant factor in deciding which language to use, especially since there are legibility tradeoffs (i.e. escaping) and the Python approach for handling e.g. groups is cleaner for non-trivial code and avoids the chance of accidentally clobbering $1, $2, etc. — a bug pattern I've seen affect people more than once.
Personally, if I were advocating Perl I'd probably go with angles like the extended capabilities or more complete Unicode support which Python users need to get from the regex module (https://pypi.org/project/regex/ https://pypi.org/project/regex/).