Skip to content
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

bpo-42198: Document __new__ for types.GenericAlias #23039

Merged
merged 2 commits into from
Oct 31, 2020

Conversation

Fidget-Spinner
Copy link
Member

@Fidget-Spinner Fidget-Spinner commented Oct 30, 2020

https://bugs.python.org/issue42198

Automerge-Triggered-By: GH:gvanrossum

Comment on lines +270 to +272
``t_origin`` should be a non-parameterized generic class, such as ``list``,
``tuple`` or ``dict``. ``t_args`` should be a :class:`tuple` (possibly of
length 1) of types which parameterize ``t_origin``::
Copy link
Member

Choose a reason for hiding this comment

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

The argument types are not checked, e.g. types.GenericAlias(1, 2) returns something with __origin__ == 1 and __args__ == (2,). But I'm not sure we ought to document that -- perhaps it's better to leave that out (even if I can see some odd use cases for it).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I noticed that you can produce things like int[str] as well (or anything for that matter). IMO, it would be best to document the current expected/common/intended use case for it. In the future if GenericAlias is used for more functionality, someone can just document that.

@miss-islington
Copy link
Contributor

Thanks @Fidget-Spinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry @Fidget-Spinner, I had trouble checking out the 3.9 backport branch.
Please backport using cherry_picker on command line.
cherry_picker bcbf758476c1148993ddf4b54d3f6169b973ee1c 3.9

@miss-islington miss-islington self-assigned this Oct 31, 2020
@gvanrossum
Copy link
Member

KJ, I don’t know why, but again this failed to backport cleanly...

@bedevere-bot
Copy link

GH-23061 is a backport of this pull request to the 3.9 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Oct 31, 2020
@Fidget-Spinner
Copy link
Member Author

KJ, I don’t know why, but again this failed to backport cleanly...

From the past two cherry picks, it seems like the 3.10 docs have stuff only in 3.10 immediately surrounding the GenericAlias docs. So when I insert new lines, it thinks I want to commit the stuff below too. I'm guessing that this is going to be a cherry picking landmine from now on :(.

miss-islington pushed a commit that referenced this pull request Oct 31, 2020
@Fidget-Spinner Fidget-Spinner deleted the docs-ga-new branch October 31, 2020 15:26
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
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 news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants