# PEP 701 – Syntactic formalization of f-strings

**URL:** <https://discuss.python.org/t/pep-701-syntactic-formalization-of-f-strings/22046>\
**Category:** PEPs\
**Created:** [December 19, 2022, 5:53pm UTC](https://discuss.python.org/t/pep-701-syntactic-formalization-of-f-strings/22046 "2022-12-19T17:53:22Z")\
**Posts on this page:** 1\
**Showing post:** 68

<div class="post-metadata">

**Author:** ![malemburg](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/malemburg/32/50_2.png) [@malemburg](https://discuss.python.org/u/malemburg)\
**Post date:** [December 22, 2022, 11:12am UTC](https://discuss.python.org/t/pep-701-syntactic-formalization-of-f-strings/22046/68 "2022-12-22T11:12:08Z")

</div>

Couldn’t resist…

```auto
def bart(foo):
    f"""{(

    foo := foo + 1,
    print('Finally, curly brackets in Python ;-)'),
    [
        print('Teacher: You should not use full Python in f-strings.')
        for i in range(foo)
    ],
    print(f'But you can... {foo}-)')

)}"""

bart(7)

```

…

```nohighlight
Finally, curly brackets in Python ;-)
Teacher: You should not use full Python in f-strings.
Teacher: You should not use full Python in f-strings.
Teacher: You should not use full Python in f-strings.
Teacher: You should not use full Python in f-strings.
Teacher: You should not use full Python in f-strings.
Teacher: You should not use full Python in f-strings.
Teacher: You should not use full Python in f-strings.
Teacher: You should not use full Python in f-strings.
But you can... 8-)

```

This is already possible in 3.10, but I strongly doubt that it was ever intended. Should we really head on in the same direction even more ?

Just to be clear: I like the PEP and support it, since it simplifies the implementation and removes some annoying bits (e.g. the backslash limitation), but I don’t like the removal of the string literal quoting rules and support for arbitrary nesting of f-strings. By keeping the quote restriction, arbitrary nesting can be prevented.

---

_[View the full topic](https://discuss.python.org/t/pep-701-syntactic-formalization-of-f-strings/22046)._
