typing: Deprecate creating a NamedTuple with kwargs (#11567)

c5fa796619/Lib/typing.py (L2874)
This commit is contained in:
Jelle Zijlstra
2024-03-10 16:20:35 -07:00
committed by GitHub
parent 354ecd084f
commit a6bdb25991

View File

@@ -871,6 +871,9 @@ class NamedTuple(tuple[Any, ...]):
@overload
def __init__(self, typename: str, fields: Iterable[tuple[str, Any]], /) -> None: ...
@overload
@typing_extensions.deprecated(
"Creating a typing.NamedTuple using keyword arguments is deprecated and support will be removed in Python 3.15"
)
def __init__(self, typename: str, fields: None = None, /, **kwargs: Any) -> None: ...
@classmethod
def _make(cls, iterable: Iterable[Any]) -> typing_extensions.Self: ...