GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-91162: Implement splitting of *tuple[int, ...] over `T, *Ts` in typing.py by mrahtz · Pull Request #93318 · python/cpython

Conversation

@mrahtz

@mrahtz mrahtz commented May 28, 2022

Copy link
Copy Markdown
Contributor

In #91162, we decided that it should be valid to do

T = TypeVar('T')
Ts = TypeVarTuple('Ts')

Alias = tuple[T, *Ts]

Alias[*tuple[int, ...]]

and that the result should be tuple[int, *tuple[int, ...]].

This PR does the first half of the work necessary to enable this: the changes necessary in typing.py. The second half will be the equivalent machinery in genericaliasobject.c, but I'll do that in a separate PR, since I guess different people will want to review it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mrahtz
Implement splitting of *tuple[int, ...] in typing.py
4891252
@mrahtz
mrahtz requested review from Fidget-Spinner, JelleZijlstra and gvanrossum as code owners May 28, 2022 12:57
@bedevere-bot bedevere-bot added the awaiting review label May 28, 2022
@AlexWaygood AlexWaygood added the topic-typing label May 28, 2022
@AlexWaygood

AlexWaygood commented May 28, 2022

Copy link
Copy Markdown
Member

(I think this probably does need a news entry, FWIW, since it wasn't in beta 1, and I assume we'll be backporting.)

mrahtz reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@blurb-it
📜🤖 Added by blurb_it.
fce35f1
@mrahtz

mrahtz commented May 28, 2022

Copy link
Copy Markdown
Contributor Author

I've just realised; TODO @mrahtz What happens if there's more than one unpacked arbitrary-length tuple in the args list?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mrahtz added 2 commits May 28, 2022 15:44
@mrahtz
Switch to simpler implementation
75525fd
@mrahtz
Add test for multiple arbitrary-length unpacked tuples in args list
6b0780b
@mrahtz

mrahtz commented May 28, 2022

Copy link
Copy Markdown
Contributor Author

I've just realised; TODO @mrahtz What happens if there's more than one unpacked arbitrary-length tuple in the args list?

Thanks past me! Added a test for this situation.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mrahtz mrahtz mentioned this pull request May 29, 2022
PEP 646: Decide on substitution behavior #91162
Closed
@mrahtz

mrahtz commented May 29, 2022

Copy link
Copy Markdown
Contributor Author

Closing in favour of Serhiy's: #93330

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mrahtz mrahtz closed this May 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gvanrossum gvanrossum Awaiting requested review from gvanrossum
@Fidget-Spinner Fidget-Spinner Awaiting requested review from Fidget-Spinner
@JelleZijlstra JelleZijlstra Awaiting requested review from JelleZijlstra JelleZijlstra is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting review topic-typing

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@mrahtz @AlexWaygood @bedevere-bot
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.