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

Use of TypeVar(... bound=Example) vs Type[Example] #8

Open
Dantali0n opened this issue May 4, 2021 · 0 comments
Open

Use of TypeVar(... bound=Example) vs Type[Example] #8

Dantali0n opened this issue May 4, 2021 · 0 comments
Labels
discussion Further information is required or should be discussed help wanted Extra attention is needed

Comments

@Dantali0n
Copy link
Owner

From the Python documentation it is clear that using TypeVar(... bound=Example) will constraint the type to a subclass of Example.

What is unclear is how:

_U = TypeVar('_U', bound=Example)
Type[_U]

Is different from:

Type[Example]

Is there any reason to prefer one over the other? and what are the consequences of these differences?

@Dantali0n Dantali0n added help wanted Extra attention is needed discussion Further information is required or should be discussed labels May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Further information is required or should be discussed help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant