Overview
Is it in-scope to suggest wrapping a multiline string literal inside textwrap.dedent() to keep it readable and consistently indented?
Proposal
$ cat a.py
#!/usr/bin/env python3
import textwrap
class C:
def make_with_dedent(self):
literal = textwrap.dedent("""\
This is a multiline
string literal.
""")
return literal
def make_without_dedent(self):
literal = """\
This is another multiline
string literal.
"""
return literal
print(C().make_with_dedent())
print(C().make_without_dedent())
$ ./a.py
This is a multiline
string literal.
This is another multiline
string literal.
A big thanks to alonzodemo at OpenStreetMap for teaching me the trick.
Overview
Is it in-scope to suggest wrapping a multiline string literal inside textwrap.dedent() to keep it readable and consistently indented?
Proposal
A big thanks to alonzodemo at OpenStreetMap for teaching me the trick.