-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
I wonder if that is supposed to work. If not, please tell why.
{k: v for k in ('one', 'two') if (v := getattr(run_args, k))}
This seem to be probably good idea to do it so. I was always sad that I'm unable to compute and check the value inside the comprehension and then use it as a data source. This forces developer to not use comprehension or use it in non-optimal way, calculating same things twice.
Current behavior on mypy 0.782, Python 3.8.3
It produces internal error:
workers/base.py:21: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
If this issue continues with mypy master, please report a bug at https://github.com/python/mypy/issues
version: 0.782
workers/base.py:21: : note: please use --show-traceback to print a traceback when reporting a bug
and with mentioned flag:
mypy --show-traceback
workers/base.py:21: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.782
Traceback (most recent call last):
File "mypy/semanal.py", line 4691, in accept
File "mypy/nodes.py", line 1062, in accept
File "mypy/semanal.py", line 1906, in visit_assignment_stmt
File "mypy/nodes.py", line 1983, in accept
File "mypy/semanal.py", line 3762, in visit_dictionary_comprehension
File "mypy/semanal.py", line 3790, in analyze_comp_for
File "mypy/nodes.py", line 1618, in accept
File "mypy/semanal.py", line 1896, in visit_assignment_expr
File "mypy/semanal.py", line 2565, in analyze_lvalue
File "mypy/semanal.py", line 2616, in analyze_name_lvalue
File "mypy/semanal.py", line 4217, in add_symbol
File "mypy/semanal.py", line 4265, in add_symbol_table_node
File "mypy/semanal.py", line 4553, in current_symbol_table
AssertionError:
workers/base.py:21: : note: use --pdb to drop into pdb
In any case of:
- type hinting is specified
- no type-hinting specified
- # type: ignore is specified in the end of line containing the expression
Metadata
Metadata
Assignees
Labels
No labels