Author Miguel Amaral
Recipients Marco Sulla, Miguel Amaral, gregory.p.smith, josh.r, mbussonn, methane, pablogsal, remi.lapeyre, rhettinger, serhiy.storchaka, steven.daprano
Date 2020-04-03.10:54:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
A related issue(which I believe has no topic in this forum yet) is substituting an expression that results in a multiline string into a multiline f-string while matching its indentation.
If a new type of string prefix is made to auto-dedent, maybe the substitutions should match the local indentation.
Some related stackoverflow posts:

I.e. ideally we would have:
def make_g_code():
  return d"""\
    def g():
      {nl.join(something(i) for i in range(n))}
      return something_else
This still has issues. Newline needs to be put into a variable, for instance. In the case of using this template for languages, great many use braces for delimiting blocks and those need to be escaped inside f-strings.

An implementation that works with spaces only (does not suit my case where mixed indentation is possible) is here:

Please let me know if this is the wrong place to comment on this issue.
Date User Action Args
2020-04-03 10:54:09Miguel Amaralsetrecipients: + Miguel Amaral, rhettinger, gregory.p.smith, steven.daprano, methane, serhiy.storchaka, josh.r, mbussonn, pablogsal, remi.lapeyre, Marco Sulla
2020-04-03 10:54:09Miguel Amaralsetmessageid: <>
2020-04-03 10:54:09Miguel Amarallinkissue36906 messages
2020-04-03 10:54:09Miguel Amaralcreate