Through PEP 701, Python 3.12 lifts restrictions on how to construct "f-strings".
Prior to Python 3.12, it was not possible to reuse string quotes when nesting "f-strings". Therefore, the maximum level of nesting was:
f"""{f'''{f'{f"{1+1}"}'}'''}"""
It is now possible to arbitrarily nest "f-strings" by reusing string quotes. The following snippet is therefore valid:
f"{f"{f"{f"{f"{f"{1+1}"}"}"}"}"}"
It is, however, not recommended to nest "f-strings" too deeply as this would make the code confusing and hard to maintain.
This rule will raise an issue when "f-string" literals are nested 3 times or more.