<div dir="auto"><br><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">On Mar 28, 2017 06:08, "Steven D'Aprano" <<a href="mailto:steve@pearwood.info">steve@pearwood.info</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">On Mon, Mar 27, 2017 at 05:17:40PM +0200, Simon D. wrote:<br>
<br>
> The regexp string litteral could be represented by : re""<br>
><br>
> It would ease the use of regexps in Python, allowing to have some regexp<br>
> litterals, like in Perl or JavaScript.<br>
><br>
> We may end up with an integration like :<br>
><br>
> >>> import re<br>
> >>> if re".k" in 'ok':<br>
>     ... print "ok"<br>
>     ok<br>
<br>
</div>I dislike the suggested syntax re".k". It looks ugly and not different<br>
enough from a raw string. I can easily see people accidentally writing:<br>
<br>
    if r".k" in 'ok':<br>
        ...<br>
<br>
and wondering why their regex isn't working.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">While I agree with most of your arguments, surely you must be the one joking here? "Ugly" is obviously a matter of opinion, I personally find the proposed syntax more beautiful than the // used in many other languages. But claiming it's bad because people would mix it up with raw strings and people not realizing is nonsense. Not only does it look very different, but attempting to call match() or any other regex method on it would surely give out a reasonable error:</div><div dir="auto"><br></div><div dir="auto">  AttributeError: 'str' object has no attribute 'match'</div><div dir="auto"><br></div><div dir="auto">Which _in the worst case scenario_ results into googling where the top rated StackOverflow question clearly explains the difference between r'' and re''</div><div class="gmail_extra" dir="auto"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"></blockquote></div></div></div>