-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Document PEP 695 #103921
Comments
Ideally we should also add the new builtin types to the list of stdtypes https://docs.python.org/3/library/stdtypes.html#type-annotation-types-generic-alias-union IMO, they ought to belong there instead of |
I agree that we should make sure that PEP 695 is presented as the idiomatic, modern way of writing generic functions and classes. But I'd like us to make sure that the old-style way of doing things also continues to be well documented in |
This allows :keyword:`type` to link to docs for the new `type` statement (being written in pythongh-104642) instead of to this header in the argparse docs.
I'm not sure about this. The types still claim that their |
I agree with @Fidget-Spinner. >>> type(list[int]).__module__
'types'
>>> type(int | str).__module__
'types' Builtin types that have dedicated syntax should all be documented in the same place ( |
I know, and I don't really like how the docs for GenericAlias and UnionType are organized; they'd probably also be cleaner if more of the docs were under As a contrary example, Concrete problems I see with documenting these types in stdtypes:
My preference would be to keep the main documentation for TypeVar etc. in typing.rst, but add a note about them to https://docs.python.org/3.10/library/stdtypes.html#type-annotation-types-generic-alias-union. |
Fair enough, I've also thought this in the past. I see the point about not wanting to break all cross-references to |
* main: (30 commits) pythongh-103987: fix several crashes in mmap module (python#103990) docs: fix wrong indentation causing rendering error in dis page (python#104661) pythongh-94906: Support multiple steps in math.nextafter (python#103881) pythongh-104472: Skip `test_subprocess.ProcessTestCase.test_empty_env` if ASAN is enabled (python#104667) pythongh-103839: Allow building Tkinter against Tcl 8.7 without external libtommath (pythonGH-103842) pythongh-85984: New additions and improvements to the tty library. (python#101832) pythongh-104659: Consolidate python examples in enum documentation (python#104665) pythongh-92248: Deprecate `type`, `choices`, `metavar` parameters of `argparse.BooleanOptionalAction` (python#103678) pythongh-104645: fix error handling in marshal tests (python#104646) pythongh-104600: Make type.__type_params__ writable (python#104634) pythongh-104602: Add additional test for listcomp with lambda (python#104639) pythongh-104640: Disallow walrus in comprehension within type scopes (python#104641) pythongh-103921: Rename "type" header in argparse docs (python#104654) Improve readability of `typing._ProtocolMeta.__instancecheck__` (python#104649) pythongh-96522: Fix deadlock in pty.spawn (python#96639) pythonGH-102818: Do not call `PyTraceBack_Here` in sys.settrace trampoline. (pythonGH-104579) pythonGH-103545: Add macOS specific constants for ``os.setpriority`` to ``os`` (python#104606) pythongh-104623: Update macOS installer to SQLite 3.42.0 (pythonGH-104624) pythongh-104619: never leak comprehension locals to outer locals() (python#104637) pythongh-104602: ensure all cellvars are known up front (python#104603) ...
Co-authored-by: Alex Waygood <[email protected]>
(cherry picked from commit 060277d) Co-authored-by: Jelle Zijlstra <[email protected]> Co-authored-by: Alex Waygood <[email protected]>
(cherry picked from commit 060277d) Co-authored-by: Jelle Zijlstra <[email protected]> Co-authored-by: Alex Waygood <[email protected]>
I think we're done here! |
Co-authored-by: Alex Waygood <[email protected]>. (cherry picked from commit 060277d) Co-authored-by: Jelle Zijlstra <[email protected]>
Co-authored-by: Alex Waygood <[email protected]>
…GH-105093) (cherry picked from commit c8c1e73) Co-authored-by: Alex Waygood <[email protected]>
…5093) (#105101) (cherry picked from commit c8c1e73) Co-authored-by: Alex Waygood <[email protected]>
* main: CI: Temporarily skip paths with spaces to avoid error (python#105110) pythongh-105071: add missing versionadded directive (python#105097) pythongh-80064: Fix is_valid_wide_char() return type (python#105099) Small speedup for dataclass __eq__ and __repr__ (python#104904) pythongh-103921: Minor PEP-695 fixes to the `ast` module docs (python#105093) pythongh-105091: stable_abi.py: Remove "Unixy" check from --all on other platforms (pythonGH-105092)
We should document PEP-695 for Python 3.12 (issue #103763, PR #103764 for implementation). I am leaving docs out of the PR to avoid complicating an already huge PR with a tight deadline, but let's start thinking about what we need to document:
ast.rst
typing.rst
should list the PEPtyping.rst
should mention thatTypeVar
gained aninfer_variance
argument and that it now supports lazily evaluated bounds/constraintstyping.rst
should use the new syntaxtyping.rst
should document the newTypeAliasType
typing.TypeAlias
should be mentioned as deprecated (including in the deprecation timeline at the bottom oftyping.rst
), and any examples of type aliases should be updated to use the new syntaxdis.rst
.dis.dis
docs should mention new contexts where nested code objects can appear. TheCALL_INTRINSIC_1
and 2 opcodes should mention the new intrinsics.Linked PRs
ast
module docs #105093ast
module docs (GH-105093) #105101The text was updated successfully, but these errors were encountered: