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

I cannot the vote because of time limit. So I repost it.

I want to poll about d-string vs __future__ import.
__future__ import changes syntax of triple quote string literal like proposed d-string.

  • d-string makes string prefix more complex.
    • E.g. d/D/df/dF/DF/Df/fd/fD/FD/Fd/dt/dT/DT/Dt/td/tD/TD/Td/ud/...
    • But it doesn’t break backward compatibility in the future.
  • __future__ import doesn’t need new prefix.
    • It changes all triple quote literals.
    • It will break backward compatibility in the future. But it will make language simple.
    • Tools like pyupgrade would help the transition.
  • str.dedent() is the most simple option.
    • But it cannot work nicely with t/f-string.
      • People want to use t-string for HTML or SQL. And they want to dedent it too.
    • It cannot work nicely with line continuation too.
    • Vote to d-string or __future__ import if you want both of dedenting literal and str.dedent()
      • Because we are discussing about literal improvement is necessary or not.
  • Add d-prefix to string literal
  • __future__ import changes triple quote literal to auto dedent
  • Add str.dedent() and never add d-string nor __future__ import.
  • Status quo; never add any.
0 voters
1 Like