-
Notifications
You must be signed in to change notification settings - Fork 242
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
Add the typing spec #1517
Add the typing spec #1517
Conversation
Copied over from https://github.com/JelleZijlstra/typing-spec The text largely derives from the typing PEPs, though I added some material. The organization is based on an outline by @erictraut. @rchen152 and @Daverball made contributions to the text.
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.
One minor thing for later is we have a bunch of links to PEPs that should maybe become internal links
@hauntsaninja I agree, but won't have time right now to fix that. As you say, let's leave it for later. |
|
||
(Originally specified in :pep:`702`.) | ||
|
||
The :py:func:`warnings.deprecated` |
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.
The :py:func:`warnings.deprecated` | |
The :class:`warnings.deprecated` |
As this is now implemented as a class?
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.
It's not documented as a class: https://docs.python.org/3.13/library/warnings.html#warnings.deprecated
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.
Ah yes makes sense, it isn't auto-generated docs
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.
I'm not sure how precise a review you're expecting. I'm okay if this goes in right away (we can iterate on everything), but here are some thoughts that came up when I skimmed it.
docs/spec/Makefile
Outdated
@@ -0,0 +1,20 @@ | |||
# Minimal makefile for Sphinx documentation |
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.
Why is this here? I went into this directory and typed make venv
but it complained about a missing conf.py
.
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.
Oops, probably a holdover from when it was in its own repo. I'll get rid of it. (You should make
in the parent directory, which includes this spec and the other typing docs.)
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.
Yeah, I figured that out eventually. It's a bit weird how clicking on the Table of Contents header at the top of the sidebar takes you to the global ToC, not the Spec ToC, even though there is no "Next topic" linked from spec/historical.html, the last topic in Spec (so I would expect that the ToC link would go to the Spec ToC). But that's a very minor detail at this point, and probably some Sphinx oddity.
@@ -0,0 +1,95 @@ | |||
Type system concepts |
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.
This feels like a grab-bag section, and it's oddly placed at the start of the document (why start with unions, when nothing else has been described yet)?
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.
This comes from Eric's outline in https://discuss.python.org/t/proposed-initial-typing-spec/39389/4, but I omitted the sections for which we don't have any text yet. I'm open to reorganizing this, but we can do that later too.
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.
Later is fine.
@@ -0,0 +1,291 @@ | |||
.. _historical: |
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.
Maybe add from __future__ import annotations
to this page? I was reminded of it in the section about forward references. I think it's within the scope of the typing spec, since it changes semantics: even if you don't use runtime introspection, enabling it changes what gets accepted.
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.
I'm not sure it does; shouldn't type checkers infer the same types with and without the future import? Obviously the future import affects the runtime behavior, but this spec doesn't need to describe that.
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.
Huh, I suppose. Does the spec not describe any runtime behavior?
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.
It does in a few cases, but in principle I think it shouldn't. docs.python.org describes how Python the language works; this spec should only describe the semantics of the type system.
Thanks! I think a general review is enough; this text is so big that we can't hope to get it all right, and I primarily want this in so we can start iterating on it and improving it. |
Copied over from https://github.com/JelleZijlstra/typing-spec
The text largely derives from the typing PEPs, though I added some
material. The organization is based on an outline by @erictraut.
@rchen152 and @Daverball made contributions to the text.
This was previously discussed on https://discuss.python.org/t/proposed-initial-typing-spec/39389. I'll submit an issue to the Typing Council to request its imprimatur.