Skip to content

Rename typevar('T', values=(t1, t2, ...)) to TypeVar('T', t1, t2, ...) #539

Closed
@gvanrossum

Description

@gvanrossum

In the typehinting PEP the proposal is to use Var() instead of typevar(), and to make the constraints just varargs, rather than a keyword parameter (and why would the keyword be 'values'?).

The semantics of typevar() are fine. The PEP currently seems to state that two Var() calls with the same name generate equivalent variables, whereas mypy treats every typevar() as unique. It also enforces that the typevar is assigned to a variable with the same name as the typevar argument. I think the mypy rules are better, and easier to implement, so I prefer those.

See also python/typing#1 for the first issue (renaming, signature change) and python/typing#29 for the second (uniqueness).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions