Skip to content

'"ClassName" expects no type arguments, but 1 given' while inheriting from Iterable #2425

Closed
@sametmax

Description

@sametmax

I have a class looking like this:

from collection import Iterable, Iterator
class IterableWrapper(Iterator, Iterable, BaseWrapper):
    ...

And a function type definition later going:

# type: (...) -> IterableWrapper[tuple[T, T2]]

Mypy complains:

src/ww/wrappers/iterables.py:600: error: "IterableWrapper" expects no type arguments, but 1 given

While:

# type: (...) -> IterableWrapper and # type: (...) -> Iterable[tuple[T, T2]] don't get any warning.

I was expecting that, inheriting from Iterable, I could do IterableWrapper[tuple[T, T2]] like I would do Iterable[tuple[T, T2]] and benefit from code checking on yielded elements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions