[New-bugs-announce] [issue34175] typing.NamedTuple: type-checking error when "index" used as member
Keith Campbell
report at bugs.python.org
Fri Jul 20 17:08:00 EDT 2018
New submission from Keith Campbell <keith at doctorigor.com>:
Find the test case below:
----
from typing import NamedTuple
class Foo(NamedTuple):
alpha: int
index: int
----
This results in the following error when run through type-checking with mypy:
----
% mypy --version
mypy 0.620
% mypy go.py
go.py:5: error: Incompatible types in assignment (expression has type "int", base class "tuple" defined the type as "Callable[[Tuple[int, ...], Any, int, int], int]")
----
When I instantiate this class in the python interpreter, I have no problem accessing the "index" member, so I suspect this is a bug in the type checker.
----------
components: Library (Lib)
messages: 322038
nosy: campkeith
priority: normal
severity: normal
status: open
title: typing.NamedTuple: type-checking error when "index" used as member
versions: Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34175>
_______________________________________
More information about the New-bugs-announce
mailing list