[Python] Why Iterator[Never] shoud be return instead of Iterator[None]

Discussão em 'Python' iniciado por Stack, Agosto 8, 2025.

  1. Stack

    Stack Membro Participativo

    @contextlib.contextmanager
    def sone_test(self) -> Iterator[None]:
    #some actions
    yield
    #some actions


    mypy suggest Iterator[Never] instead of Iterator[None]. Does Never mean that it never returns the yield?

    Why?

    mypy version - 1.11.2

    Continue reading...

Compartilhe esta Página