forked from python/cpython
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pythongh-105566: Deprecate unusual ways of constructing `typing.Named…
…Tuple`s
- Loading branch information
1 parent
8e75592
commit be88d69
Showing
5 changed files
with
139 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
Misc/NEWS.d/next/Library/2023-06-09-20-34-23.gh-issue-105566.YxlGg1.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Deprecate creating a :class:`typing.NamedTuple` class using keyword | ||
arguments to denote the fields (``NT = NamedTuple("NT", x=int, y=str)``). | ||
Use the class-based syntax or the functional syntax instead. | ||
|
||
Two methods of creating ``NamedTuple``\s with 0 fields using the functional | ||
syntax are also deprecated: ``NT = NamedTuple("NT")`` and ``NT = | ||
NamedTuple("NT", None)``. To create a ``NamedTuple`` class with 0 fields, | ||
either use ``class NT(NamedTuple): ...`` or ``NT = NamedTuple("NT", [])``. |