Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions stdlib/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -680,10 +680,13 @@ class NamedTuple(Tuple[Any, ...]):
_field_defaults: dict[str, Any]
_fields: Tuple[str, ...]
_source: str
# NOTE: The overloads for __init__ are not strictly accurate
# (type for `fields` and `**kwargs` should be more precise than `object`)
# but typing `NamedTuple` like this makes it easier for mypy to special-case. See #6489
@overload
def __init__(self, typename: str, fields: Iterable[tuple[str, Any]] = ...) -> None: ...
def __init__(self, typename: str, fields: Iterable[tuple[str, object]] = ...) -> None: ...
@overload
def __init__(self, typename: str, fields: None = ..., **kwargs: Any) -> None: ...
def __init__(self, typename: str, fields: None = ..., **kwargs: object) -> None: ...
@classmethod
def _make(cls: Type[_T], iterable: Iterable[Any]) -> _T: ...
if sys.version_info >= (3, 8):
Expand Down