You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This has little to do with ptpython, but more with how Python works and evaluates annotations. The native Python shell does the same:
$ python3
Python 3.12.3 (main, Nov 6 2024, 18:32:19) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from __future__ import annotations
>>> x: (y := 5) = 3
File "<stdin>", line 1
SyntaxError: named expression cannot be used within an annotation
>>>
I can reproduce now - I originally opened the issue specifically because it somehow didn't happen with the default Python REPL at the time, not sure what was going on
Hi. First of all, thank you for building
ptpython
, it is amazing. It has been my go-to Python REPL coupled with my custom .pythonrc for a while now.Now to the report:
The error does not show when the
annotations
feature is not present.In my opinion, either the syntax error should not happen, or it should always occur, even when
__future__.annotations
is not enabled.I searched the issue tracker with "named expression", "within an annotation" which did not yield any results.
Python: 3.12.7
ptpython: 3.0.29
The text was updated successfully, but these errors were encountered: