On 3/23/21 9:30 AM, John Snow wrote: > On 3/23/21 10:20 AM, Eric Blake wrote: >>> -valid_name = re.compile(r'^(__[a-zA-Z0-9.-]+_)?' >>> - '[a-zA-Z][a-zA-Z0-9_-]*$') >> I'm assuming python concatenates r'' with '' in the obvious manner... >> > > FWIW, I don't think it does, actually. I believe you do need to spell > out each individual string constant with what type it is. > > (In this case, missing the second r has no effect as there are no > backslash sequences in the string.)
Aha - https://docs.python.org/3/reference/lexical_analysis.html#string-literal-concatenation talks about it more, and even mentions that joining r'' with plain '' is useful for scenarios where you want easier use of \ through only part of your overall literal (since string literal concatenation is performed at compile time). -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org