title: Why isn't it possible to use backslashes in f-strings?
body: <p>In Python >=3.6, f-strings can be used as a replacement for the <code>str.format</code> method. As a simple example, these are equivalent:</p>
  
  <pre><code>'{} {}'.format(2+2, "hey")
  f'{2+2} {"hey"}'
  </code></pre>
  
  <p>Disregarding <a href="https://www.python.org/dev/peps/pep-0498/#format-specifiers" rel="noreferrer">format specifiers</a>, I can basically move the positional arguments of <code>str.format</code> inside braces in an f-string. Note specifically that I am allowed to just put <code>str</code> literals in here, although it may seem a bit unwieldy.</p>
  
  <p>There are however some limitations. Specifically, <a href="https://www.python.org/dev/peps/pep-0498/#escape-sequences" rel="noreferrer">backslashes in any shape or form</a> are disallowed inside the braces of an f-string:</p>
  
  <pre><code>'{}'.format("new\nline")  # legal
  f'{"new\nline"}'          # illegal
  f'{"\\"}'                 # illegal
  </code></pre>
  
  <p>I cannot even use <code>\</code> to split up a long line if it's inside the braces;</p>
  
  <pre><code>f'{2+\
  2}'     # illegal
  </code></pre>
  
  <p>even though this usage of <code>\</code> is perfectly allowed inside normal <code>str</code>'s;</p>
  
  <pre><code>'{\
  }'.format(2+2)  # legal
  </code></pre>
  
  <p>It seems to me that a hard stop is coded into the parser if it sees the <code>\</code> character at all inside the braces of an f-string. Why is this limitation implemented? Though the <a href="https://www.python.org/dev/peps/pep-0498/#escape-sequences" rel="noreferrer">docs</a> specify this behavior, it does not justify why.</p>