[Python-ideas] Add regex pattern literal p""
Alexander Heger
python at 2sn.net
Sat Dec 29 00:29:32 EST 2018
for regular strings one can write
"aaa" + "bbb"
which also works for f-strings, r-strings, etc.; in regular expressions,
there is, e.g., parameter counting and references to numbered matches. How
would that be dealt with in a compound p-string? Either it would have to
re-compiled or not, either way could lead to unexpected results
p"(\d)\1" + p"(\s)\1"
or
p"^(\w)" + p"^(\d)"
regular strings can be added, bu the results of p-string could not - well,
their are not strings. This brings me to the point that
the key difference is that f- and r- strings actually return strings,
whereas p- string would return a different kind of object.
That would seem certainly very confusing to novices - and also for the
language standard as a whole.
-Alexander
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20181229/95cc315e/attachment.html>
More information about the Python-ideas
mailing list