You can shorten it further by replacing """ with ", replacing newlines with semicolons, and replacing {q} {b} {a} with {0} {1} {2}. You can do this same design with `printf`, using directives like `$1%s`. It feels more minimal than using `repr` to me, though obviously that's completely subjective.