Open cebtenzzre opened 2 years ago
Changing List[nothing]
to List[object]
or List[Any]
would almost certainly cause problems, since an empty list produces a different type when merged with another list than a non-empty one. But I can see how other type checkers not being able to use pytype-generated stubs is inconvenient; maybe we should add a mode in which pytype outputs stubs that only use features that all checkers support.
the simplest fix might be to add nothing = Any
at the top of the pyi file when run in compatibility mode
Example Code
a.py
b.py
Expected Behavior
pytype can generate a stub file for
a.py
that mypy is able to successfully read. It could representx
as e.g.List[object]
orList[Any]
.Actual Behavior
This is the generated
a.pyi
:Software Versions
Python 3.10.2 pytype 2022.06.30 mypy 0.961