With d-strings you can write the following:
def f():
return d"""First shalt thou take out the Holy Pin.
Then shalt thou count to three, no more, no less.
Three shall be the number thou shalt count, and the number of the \
counting shall be three.
Four shalt thou not count, neither count thou two, excepting that \
thou then proceed to three.
Five is right out!
Once the number three, being the third number, be reached, then \
lobbest thou thy Holy Hand Grenade of Antioch towards thy foe, \
who, being naughty in My sight, shall snuff it."""
Sentences are separated by newlines, long sentences are split on several physical lines on 80 columns in the source code, and these lines are nuicely indented, but the resulting string do not contain newlines or extra spaces in the middle of sentence. It is not possible to do this with str.dedent()
.