[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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 python bug report before. 
Hopefully this is correct.

--
components: Interpreter Core
files: test.py
messages: 410079
nosy: Samisafool
priority: normal
severity: normal
status: open
title: SyntaxError when using dict key in fstring
type: crash
versions: Python 3.10, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file50550/test.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com