Pyright & type of __path__

Is pyright incorrectly reporting the type of __path__ here?

import types
from typing import reveal_type

reveal_type(types.ModuleType.__path__)  # MutableSequence[str]
reveal_type(__path__)                   # Iterable[str]
reveal_type(types.__path__)             # Iterable[str]

image

python docs specify it’s a sequence.

Relevant typeshed issue: Unify typing for __path__?.

1 Like