Pre-PEP: d-string / Dedented Multiline Strings with Optional Language Hinting

Current polling result:

  • Improve something or not: 42 vs 5. About 90% people are +1 on improve multiline string usability!
  • Improve syntax or not: 33 vs 14. About 70% people are +1 on improve syntax.
    • But this result may not include Template.dedent() idea.
  • d-string vs __future__: 21 vs 12. About 63% people against __future__.
    • I still like __future__ idea, but I have abandoned it.

Previous poll is still open, but I want to open next poll:

Improve syntax vs add method?

  • d-string or triple-quote
  • str.dedent and Template.dedent
0 voters

If improve syntax, d-prefix or triple backquote (```)?

  • d-string
  • triple backquote
0 voters

Note for options:

    1. d-string
    • new combination of string prefixe.
    • no new symbol in syntax.
    • support dedenting line continuation.
    • remaining indent can be specified by closing quote.
    1. triple backquote (```)
    • doesn’t increase combination of string prefix.
    • but using new symbol.
    • other characteristics are the same as for d-string.
    1. str.dedent() and Template.dedent()
    • no new syntax rule is needed at all.
    • cannot dedent line-continuation.
    • f-string.dedent() and t-string.dedent() looks similar but behavior is different.
      • f-string.dedent() behavior would be pitfall
    • f-string.dedent() cannot be done at compile time.
    • remaining indent should be specified as argument. (e.g. dedent(indent=4), dedent(indent=' '*4), `dedent().indent(’ '*4), etc…)