<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace">> What's more, it's a tool that should be used</div><div class="gmail_default" style="font-family:monospace,monospace">> with considerable reluctance, because REs are essentially unreadable,</div><div class="gmail_default" style="font-family:monospace,monospace">> so every time you use one you're creating a maintenance headache.</div><div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">Well, it requires some experience to read REs, I have written many, and I still need to test thoroughly even many basic ones for that they really do what they are supposed to do.  And then there is the issue that there is many different implementation, what you have to escape, etc., varies between python (raw and regular strings), emacs, grep, overleaf, ... </div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">Never mind, my main point is that they return an object that is qualitatively different from a string, for example, in terms of concatenation.  I also think it is too specialised, and time-critical constant REs can be stored in the module body, etc., if need be.  I do that.</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">But since this is the ideas mailing list, and taking this thread on an excursion, maybe an "addition" operator could be defined for REs, such that </div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">re.compile(s1 + s1) == re.compile(s1) + re.compile(s2)</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">with the restriction that s1 and s2 are strings that are valid REs each.</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">Even that would leave questions about how to deal with compile flags; they probably should be treated the same as if they were embedded at the beginning of each string.</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">-Alexander</div></div></div></div>