-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-105286: Improve typing.py
docstrings
#105287
Merged
AlexWaygood
merged 12 commits into
python:main
from
AlexWaygood:improve-typing-docstrings
Jun 5, 2023
Merged
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e808f2b
Improve `typing.py` docstrings
AlexWaygood 7f20599
Apply suggestions from code review
AlexWaygood d59d72b
Update Lib/typing.py
AlexWaygood f96723e
Update Lib/typing.py
AlexWaygood 9f132e9
Colons
AlexWaygood e7983b2
Use two colons everywhere
AlexWaygood ff90369
Newlines following class docstrings as per PEP 257
AlexWaygood d54c06b
Nit
AlexWaygood ab3e627
Fix first line of NoReturn docstring
AlexWaygood 748c55f
Better first sentences
AlexWaygood f9e27e2
Make module docstring more user-facing
AlexWaygood 58fbb0f
Capitalise Point2D
AlexWaygood File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Make module docstring more user-facing
- Loading branch information
commit f9e27e23d0f5169d11354501086d8b80491ee89b
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
""" | ||
The typing module: Support for gradual typing as defined by PEP 484 and subsequent PEPs. | ||
|
||
At large scale, the structure of the module is following: | ||
* Imports and exports, all public names should be explicitly added to __all__. | ||
* Internal helper functions: these should never be used in code outside this module. | ||
* _SpecialForm and its instances (special forms): | ||
Any name not present in __all__ is an implementation detail | ||
that may be changed without notice. Use at your own risk! | ||
|
||
Among other things, the module includes the following: | ||
* Generic, Protocol, and internal machinery to support generic aliases. | ||
All subscripted types like X[int], Union[int, str] are generic aliases. | ||
* Various "special forms" that have unique meanings in type annotations: | ||
NoReturn, Never, ClassVar, Self, Concatenate, Unpack, and others. | ||
* Classes whose instances can be type arguments: | ||
* Classes whose instances can be type arguments to generic classes and functions: | ||
TypeVar, ParamSpec, TypeVarTuple. | ||
* The core of internal generics API: _GenericAlias and _VariadicGenericAlias, the latter is | ||
currently only used by Tuple and Callable. All subscripted types like X[int], Union[int, str], | ||
etc., are instances of either of these classes. | ||
* 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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
* Several additional protocols: | ||
* Several protocols to support duck-typing: | ||
SupportsFloat, SupportsIndex, SupportsAbs, and others. | ||
* Special types: NewType, NamedTuple, TypedDict. | ||
* Deprecated aliases for builtin types and collections.abc ABCs. | ||
""" | ||
|
||
from abc import abstractmethod, ABCMeta | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many other PEPs have revised the typing spec since PEP 484