Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Decide meaning of alias with one generic and one concrete parameter #115

Copy link
Copy link
@gvanrossum

Description

@gvanrossum
Issue body actions

See python/mypy#606. We allow the following, and they are well-defined:

from typing import TypeVar, Dict
T = TypeVar('T')
U = TypeVar('U')
X = Dict[int, str]
Y = Dict[T, U]

But what does this mean?

Z = Dict[T, int]

In typing.py this currently defines Z as something with two parameters, the second constrained to int or subclasses thereof. But another reasonable interpretation would be that Z has one parameter, corresponding to T only.

The second interpretation is actually more reasonable. (As long as we require that all parameters are either concrete or a simple type variable, not another type expression or alias containing a type variable.)

If we agree, we should define this in the PEP and implement it in typing.py.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.