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 gregory.p.smith
Recipients Marco Sulla, Miguel Amaral, gregory.p.smith, josh.r, mbussonn, methane, pablogsal, remi.lapeyre, rhettinger, serhiy.storchaka, steven.daprano, terry.reedy
Date 2020-11-22.02:14:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I expect several phases here:

(1) add a .dedent() method to str (and bytes?) - behaviors to consider mirroring are textwrap.dedent() and inspect.cleandoc().  Given their utility and similarities, it makes sense to offer both behaviors; behavior could be selected by a kwarg passed to the method.

(2a) Ponder the d" prefix - but in general I expect sentiment to be against yet another letter prefix.  They aren't pretty.  This would need a PEP.  Someone would need to champion it.

(2b) Ponder making cleandoc dedenting automatic for docstrings.  This would be enabled on a per-file basis via a `from __future__ import docstring_dedent` or similar as Serhiy suggested.  No prefix letter required.  Several releases later we could consider making it the default.  This will also need needs a PEP.

(3) Optimizations when .dedent() is called on a constant?  Nice to have, But I suggest we land (1) first as its own base implementation PR. Then consider the follow-ons in parallel.

I believe the current patch contains (1)+(3) right now.  If so we should simplify it to (1) and make (3) am immediate followup as saving the runtime cost and data space is worthwhile.

Ultimate end state: probably 1+2b+3, but even 1+3 or 1+2b is a nice win.
Date User Action Args
2020-11-22 02:14:18gregory.p.smithsetrecipients: + gregory.p.smith, rhettinger, terry.reedy, steven.daprano, methane, serhiy.storchaka, josh.r, mbussonn, pablogsal, remi.lapeyre, Marco Sulla, Miguel Amaral
2020-11-22 02:14:17gregory.p.smithsetmessageid: <>
2020-11-22 02:14:17gregory.p.smithlinkissue36906 messages
2020-11-22 02:14:16gregory.p.smithcreate