This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author josh.r
Recipients Marco Sulla, gregory.p.smith, josh.r, mbussonn, methane, pablogsal, remi.lapeyre, rhettinger, serhiy.storchaka, steven.daprano
Date 2019-11-07.00:25:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1573086347.2.0.280349568815.issue36906@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-11-07 00:25:47josh.rsetrecipients: + josh.r, rhettinger, gregory.p.smith, steven.daprano, methane, serhiy.storchaka, mbussonn, pablogsal, remi.lapeyre, Marco Sulla
2019-11-07 00:25:47josh.rsetmessageid: <1573086347.2.0.280349568815.issue36906@roundup.psfhosted.org>
2019-11-07 00:25:47josh.rlinkissue36906 messages
2019-11-07 00:25:46josh.rcreate