add difflib.diff_bytes and difflib.Match#1336
Conversation
|
|
||
| _T = TypeVar('_T') | ||
|
|
||
| Match = NamedTuple('Match', [ |
There was a problem hiding this comment.
I suppose you could use the PEP 526 syntax too, but I'll merge as-is.
There was a problem hiding this comment.
That doesn't work actually, mypy only lets you do that in 3.6.
There was a problem hiding this comment.
But IIUC stubs are always processed in 3.6 mode. (Maybe you can try this out?)
There was a problem hiding this comment.
I just tried, in 3.5 mode mypy gives
stdlib/2and3/difflib.pyi:19: error: NamedTuple class syntax is only supported in Python 3.6
Somebody (David I think?) explained that while syntactic 3.6 features work in all stubs, language-level 3.6 features don't. I'm not sure that distinction really makes sense to me, but I guess what it means concretely is that typed_ast processes stubs in 3.6 mode, but mypy's semantic analyzer uses 2.7 mode if mypy is in 2.7 mode, and the semantic analyzer is the place that rejects NamedTuple class syntax.
No description provided.