This snippet:
formatter = \"%r %r %r %r\"
print formatter % (
\"I had this thing.\",
\"That you could type up right.\",
\"But it didn\'t sing.\"
Python is clever; it'll use double quotes for strings that contain single quotes when generating the representation, to minimize escapes:
>>> 'no quotes'
'no quotes'
>>> 'one quote: \''
"one quote: '"
Add a double quote in there as well and it'll revert back to single quotes and escape any single quotes contained:
>>> 'two quotes: \'\"'
'two quotes: \'"'