Skip to content

Add TypeVar(infer_variance=True)#80

Merged
JelleZijlstra merged 1 commit intopython:mainfrom
JelleZijlstra:infervar
Oct 6, 2022
Merged

Add TypeVar(infer_variance=True)#80
JelleZijlstra merged 1 commit intopython:mainfrom
JelleZijlstra:infervar

Conversation

@JelleZijlstra
Copy link
Copy Markdown
Member

From PEP 695. Fixes #79.

@JelleZijlstra
Copy link
Copy Markdown
Member Author

I decided here not to add infer_variance support to ParamSpec. ParamSpec supports covariant=/contravariant= at runtime, but the behavior is unspecified. PEP 695 only mentions the infer_variance parameter for TypeVar.

Copy link
Copy Markdown
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Should we maybe add a mention to the README?

Copy link
Copy Markdown
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

LGTM other than maybe needing an addition to the README!

@JelleZijlstra
Copy link
Copy Markdown
Member Author

Thanks! I'll improve the README in a separate PR.

@JelleZijlstra JelleZijlstra merged commit ba776ea into python:main Oct 6, 2022
@JelleZijlstra JelleZijlstra deleted the infervar branch October 6, 2022 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for TypeVar(infer_variance=True) (PEP 695)

2 participants