PEP 822: Dedented Multiline String (d-string)

Hello @methane !

The Python Steering Council has reviewed PEP 822. While we’re generally positive about the PEP, we think it would be best to defer this feature until Python 3.16, to give it more time to solidify.

The main feedback we have is that this feature is baking into the language specific formatting style and expectations, which would be very difficult to change if we get some of the corner cases wrong. We note that the discussions about this PEP still express different opinions and we feel like consensus and convergence hasn’t been reached. Rather than prematurely approve this PEP, we want to give it more time and think that a Python 3.16 target release provides that confidence that we’re making the right choices.

Some details:

  • We’re not sure whether the semantics regarding newline stripping are going to be more useful or more of a wart that people will have to workaround.
  • Are the special rules that people have to learn (e.g. newline only after a d-string’s opening triple quoted string, the asymmetry between single quoted and triple quoted strings) easy to learn and remember, or hard to remember and easy to get wrong.
  • We’d like to see how useful d-strings would be in the standard library. We’re not saying that the stdlib should be migrated to use d-strings, but we think that would be a useful exercise to learn if the choices the PEP makes are the best they can be.
  • Adding a new string prefix is a high price, perhaps worth paying if the value it provides is large, but we don’t feel that bar has been reached yet.

Can we also find some projects where d-strings would help a lot and get some testimonials from their maintainers? We think that experience would help a lot in establishing confidence that we’re adding a language feature that truly helps, or just another way to do something similar to the alternatives, but a bit different.

The PSC thanks you for your work on this and urges you to continue to let this idea bake. We look forward to its resubmission for Python 3.16.

19 Likes