[issue46305] SyntaxError when using dict key in fstring

2022-01-08 Thread Eric V. Smith
Eric V. Smith added the comment: Yes, the behavior is intentional. It might be relaxed in the future. -- nosy: +eric.smith ___ Python tracker ___

[issue46305] SyntaxError when using dict key in fstring

2022-01-08 Thread Samisafool
Samisafool added the comment: Huh, it does seem to be intentional. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___

[issue46305] SyntaxError when using dict key in fstring

2022-01-08 Thread Samisafool
Samisafool added the comment: Is that intended behaviour? It works though. -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue46305] SyntaxError when using dict key in fstring

2022-01-08 Thread Nikita Sobolev
Nikita Sobolev added the comment: Can you please try this: ``` dict1 = { "key1": "test" } print(dict1["key1"]) print(f"key1 is {dict1['key1']}!") ``` The problem with your code is that `dict1["key1"]` used the same quotes as `f""`. -- nosy: +sobolevn

[issue46305] SyntaxError when using dict key in fstring

2022-01-07 Thread Samisafool
New submission from Samisafool : SyntaxError when using dict key in fstring Attached is a python file where this bug is visible. The error is different on CPython 3.8 and 3.9/3.10, interestingly. Occurs on CPython 3.8-10 and PyPy 3.8 7.3.7 Not sure which component to select, never filed a