Visitar URL original
gh-105286: Improve `typing.py` docstrings by AlexWaygood · Pull Request #105287 · python/cpython · GitHub
Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
  • Loading branch information
AlexWaygood and hauntsaninja authored Jun 5, 2023
commit 7f2059924b417fa62a13f1fce4ff48bbf05e2a04
4 changes: 2 additions & 2 deletions Lib/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* The public counterpart of the generics API consists of two classes: Generic and Protocol.
* Public helper functions: get_type_hints, overload, cast, final, and others.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many other public helper functions have been added that aren't listed here, so I just made it an abbreviated list and put "and others" at the end

* Deprecated aliases for collections.abc ABCs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All points except this one have examples. Is it intentional?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, they're deprecated ;p

* Several additional protocols that do not exist elsewhere in the standard library:
* Several additional protocols:
SupportsFloat, SupportsIndex, SupportsAbs, and others.
* Special types: NewType, NamedTuple, TypedDict.
"""
Expand Down Expand Up @@ -655,7 +655,7 @@ def Union(self, parameters):
"""Union type; Union[X, Y] means either X or Y.

On Python 3.10 and higher, the | operator
can also be used to denote unions in many situations;
can also be used to denote unions;
X | Y means the same thing to the type checker as Union[X, Y].

To define a union, use e.g. Union[int, str]. Details:
Expand Down