Josh Rosenberg <[email protected]> added the comment:
Is there a reason folks are supporting a textwrap.dedent-like behavior over the
generally cleaner inspect.cleandoc behavior? The main advantage to the latter
being that it handles:
'''First
Second
Third
'''
just fine (removing the common indentation from Second/Third), and produces
identical results with:
'''
First
Second
Third
'''
where textwrap.dedent behavior would leave the first string unmodified (because
it removes the largest common indentation, and First has no leading
indentation), and dedenting the second, but leaving a leading newline in place
(where cleandoc removes it), that can only be avoided by using the typically
discouraged line continuation character to make it:
'''\
First
Second
Third
'''
cleandoc behavior means the choice of whether the text begins and ends on the
same line at the triple quote doesn't matter, and most use cases seem like
they'd benefit from that flexibility.
----------
nosy: +josh.r
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue36906>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com