Re: [Python-ideas] Add regex pattern literal p""

2018-12-30 Thread Alexander Heger
> What's more, it's a tool that should be used > with considerable reluctance, because REs are essentially unreadable, > so every time you use one you're creating a maintenance headache. Well, it requires some experience to read REs, I have written many, and I still need to test thoroughly even

Re: [Python-ideas] Add regex pattern literal p""

2018-12-30 Thread Greg Ewing
I don't see a justification for baking REs into the syntax of Python. In the Python world, REs are just one tool in a toolbox containing a great many tools. What's more, it's a tool that should be used with considerable reluctance, because REs are essentially unreadable, so every time you use

Re: [Python-ideas] Add regex pattern literal p""

2018-12-30 Thread Greg Ewing
Steven D'Aprano wrote: _t1 = re.compile(r"(\d)\1") # compile-time _t2 = re.compile(r"(\s)\1") # compile-time re.compile(_t1.pattern + _t2.pattern) # run-time It would be weird if p"(\d)\1" + p"(\s)\1" worked but re.compile(r"(\d)\1") + re.compile(r"(\s)\1") didn't. -- Greg