| @overload | ||
| def __getitem__(self, s: slice) -> 'array[_T]': ... | ||
|
|
||
| @overload # type: ignore # Overrides MutableSequence |
There was a problem hiding this comment.
MutableSequence, the supertype, defines __setitem__() like this:
But array requires an array instance. The # type: ignore comment quiets the Signature of "__setitem__" incompatible with supertype "MutableSequence" error emitted by mypy, but pytype doesn't emit an error when the type comment is omitted nor does it like the type comment.
Any thoughts on how to handle this one?
Sorry, something went wrong.
There was a problem hiding this comment.
I can't think of anything else here than lying about the signature and putting Iterable[_T]. We can put a TODO to fix it when pytype's parser becomes more permissive (cc @matthiaskramm).
Sorry, something went wrong.
|
pytype has its own array.pyi, so it's fine if we just blacklist this file, in tests/pytype_blacklist.txt, with a comment that we had to because pytype doesn't yet support "# type: ignore" after decorators. (That's what is breaking, right?) |
Sorry, something went wrong.
|
Sounds good, can you implement Matthias's suggestion? |
Sorry, something went wrong.
|
Hey, if you also copy this into stdlib/2 (with very minor changes) then it will fix #1608. |
Sorry, something went wrong.
|
@gvanrossum I submitted pull request #1670 to merge array stubs. |
Sorry, something went wrong.
It also improves the type checking of contained values. Some methods
were removed because they are implemented by a base class (i.e.,
iter(), str(), and contains()). hash() was
removed because arrays are unhashable types.