PEP 701: Correct link to nested interpolation strings (#2933)
This commit is contained in:
parent
805b973c1b
commit
09032faf9b
20
pep-0701.rst
20
pep-0701.rst
|
@ -55,8 +55,22 @@ Some of these limitations (collected originally by :pep:`536`) are:
|
|||
SyntaxError: f-string expression part cannot include '#'
|
||||
|
||||
#. Arbitrary nesting of expressions without expansion of escape sequences is
|
||||
available in every single other language employing a string interpolation
|
||||
method that uses expressions instead of just variable names, `per Wikipedia`_.
|
||||
available in many other languages that employ a string interpolation
|
||||
method that uses expressions instead of just variable names. Some examples:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
# Ruby
|
||||
"#{ "#{1+2}" }"
|
||||
|
||||
# JavaScript
|
||||
`${`${1+2}`}`
|
||||
|
||||
# Swift
|
||||
"\("\(1+2)")"
|
||||
|
||||
# C#
|
||||
$"{$"{1+2}"}"
|
||||
|
||||
These limitations serve no purpose from a language user perspective and
|
||||
can be lifted by giving f-literals a regular grammar without exceptions
|
||||
|
@ -398,8 +412,6 @@ Footnotes
|
|||
|
||||
.. _presented at the Python Language Summit 2022: https://pyfound.blogspot.com/2022/05/the-2022-python-language-summit-f.html
|
||||
|
||||
.. _per Wikipedia: https://en.wikipedia.org/wiki/String_interpolation#Examples
|
||||
|
||||
.. _implementation: https://github.com/we-like-parsers/cpython/tree/fstring-grammar
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue