Walrus operators unrecognised in dictionary initialisation of a class attribute #8379
Labels
bug
mypy got something wrong
topic-pep-572
PEP 572 (walrus operator)
topic-runtime-semantics
mypy doesn't model runtime semantics correctly
It seems Walrus operators (in Python 3.8+) are not recognised by mypy when used in initialising a dictionary of a class attribute. Here is a test code.
This outputs the following:
If the variable
CKEY
is out of the class definition, i.e. if directly in Main, it does not raise an error.I tested it with Python 3.8.1 and mypy version
0.770+dev.8888b1aedf6d4ba543ae12f538f190ce5e65c20d
(yesterday's head).The text was updated successfully, but these errors were encountered: