Message381584
| 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 | <1606011257.95.0.669250059633.issue36906@roundup.psfhosted.org> |
| In-reply-to |
| Content | |
|---|---|
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. https://docs.python.org/3/library/textwrap.html#textwrap.dedent https://docs.python.org/3/library/inspect.html#inspect.cleandoc (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. |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2020-11-22 02:14:18 | gregory.p.smith | set | recipients: + 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:17 | gregory.p.smith | set | messageid: <1606011257.95.0.669250059633.issue36906@roundup.psfhosted.org> |
| 2020-11-22 02:14:17 | gregory.p.smith | link | issue36906 messages |
| 2020-11-22 02:14:16 | gregory.p.smith | create | |