Skip to content

typing docs: Move some classes out of the "Generics" section #104707

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

Merged
merged 2 commits into from
May 21, 2023

Conversation

JelleZijlstra
Copy link
Member

@JelleZijlstra JelleZijlstra commented May 20, 2023

  • AnyStr can be used in type annotations, contrary to the section header
  • Unpack can also be used in annotations, and its use is not restricted
    to generics. It makes more sense with other building blocks like Required.
  • Protocol is not necessarily generic.

Also fix the indentation for two notes associated with Concatenate.

Split off from #104642, but I think this change is independently an
improvement.


📚 Documentation preview 📚: https://cpython-previews--104707.org.readthedocs.build/

- AnyStr can be used in type annotations, contrary to the section header
- Unpack can also be used in annotations, and its use is not restricted
  to generics. It makes more sense with other building blocks like Required.
- Protocol is not necessarily generic.

Also fix the indentation for two notes associated with Concatenate.

Split off from python#104642, but I think this change is independently an
improvement.
@JelleZijlstra
Copy link
Member Author

(Note these were all in a section that starts with "These are not used in annotations. They are building blocks for creating generic types.")

@JelleZijlstra
Copy link
Member Author

@AlexWaygood could you review this one so it doesn't accumulate merge conflicts? Thanks!

@JelleZijlstra JelleZijlstra merged commit ab71acd into python:main May 21, 2023
@JelleZijlstra JelleZijlstra deleted the movethetypes branch May 21, 2023 13:00
@AlexWaygood
Copy link
Member

AlexWaygood commented May 21, 2023

Should we backport this to 3.11? The changes are an improvement on their own, I think, and backporting could help reduce the risk of future merge conflicts.

@JelleZijlstra JelleZijlstra added the needs backport to 3.11 only security fixes label May 21, 2023
@miss-islington
Copy link
Contributor

Thanks @JelleZijlstra for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry, @JelleZijlstra, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker ab71acd67b5b09926498b8c7f855bdb28ac0ec2f 3.11

@bedevere-bot
Copy link

GH-104721 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label May 21, 2023
JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this pull request May 21, 2023
…ythonGH-104707)

- AnyStr can be used in type annotations, contrary to the section header
- Unpack can also be used in annotations, and its use is not restricted
  to generics. It makes more sense with other building blocks like Required.
- Protocol is not necessarily generic.

Also fix the indentation for two notes associated with Concatenate.

Split off from pythonGH-104642, but I think this change is independently an
improvement..
(cherry picked from commit ab71acd)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
AlexWaygood added a commit that referenced this pull request May 21, 2023
…H-104707) (#104721)

- AnyStr can be used in type annotations, contrary to the section header
- Unpack can also be used in annotations, and its use is not restricted
  to generics. It makes more sense with other building blocks like Required.
- Protocol is not necessarily generic.

Also fix the indentation for two notes associated with Concatenate.

(cherry picked from commit ab71acd)

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@JelleZijlstra JelleZijlstra restored the movethetypes branch September 10, 2024 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants