[issue34175] typing.NamedTuple: type-checking error when "index" used as member

2018-07-21 Thread Keith Campbell


Keith Campbell  added the comment:

> It's up to the OP to file an issue there though

Will do; thanks!

--

___
Python tracker 

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



[issue34175] typing.NamedTuple: type-checking error when "index" used as member

2018-07-20 Thread Guido van Rossum


Guido van Rossum  added the comment:

> Perhaps this report should go on the mypy bug tracker rather than the Python 
> language tracker.

Agreed. It's up to the OP to file an issue there though (hence adding 
@campkeith back to the nosy list).

--
nosy: +campkeith
resolution:  -> third party
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



[issue34175] typing.NamedTuple: type-checking error when "index" used as member

2018-07-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> So I suspect this is a bug in the type checker.

Perhaps this report should go on the mypy bug tracker rather than the Python 
language tracker.

--
nosy: +gvanrossum, levkivskyi, rhettinger -campkeith

___
Python tracker 

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



[issue34175] typing.NamedTuple: type-checking error when "index" used as member

2018-07-20 Thread Keith Campbell


New submission from Keith Campbell :

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 

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