Skip to content

Conversation

@fangyi-zhou
Copy link
Contributor

Closes#2145

This spec change reconciles the typing spec and the conformance testsuite. tuple is an object of the type class, so it should be accepted as a value of type.

Closespython#2145 This spec change reconciles the typing spec and the conformance testsuite. `tuple` is an object of the `type` class, so it should be accepted as a value of `type`.
@srittausrittau added Typing Council decision Needs to be approved by the Typing Council. Do not merge until approved. topic: typing spec For improving the typing spec labels Jan 7, 2026
Copy link
Collaborator

@erictrauterictraut left a comment

Choose a reason for hiding this comment

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

I don't think the new wording should mention tuple at all. It's not a special form. It's simply a class.

The problem here is the phrase special constructs, which is not defined anywhere in the spec and is therefore ambiguous. I think we should change this to special form, which is defined in the glossary.

@fangyi-zhoufangyi-zhou changed the title Clarify that tuple should be accepted as an argument to typeClarify that tuple should not be prohibited as an argument to typeJan 7, 2026
Copy link
Member

@carljmcarljm left a comment

Choose a reason for hiding this comment

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

Updated wording here LGTM.

@encukou
Copy link
Member

Maybe add an extra sentence now?

Tuples, for example ``type[A, B]``, are also not allowed. 

@erictraut
Copy link
Collaborator

Maybe add an extra sentence now?

No, this is already covered elsewhere in the spec. We try to avoid redundancies because they create confusion and potential inconsistencies.

@fangyi-zhou
Copy link
ContributorAuthor

Maybe add an extra sentence now?

No, this is already covered elsewhere in the spec. We try to avoid redundancies because they create confusion and potential inconsistencies.

@erictraut Do you mean this is covered in the grammar in https://typing.python.org/en/latest/spec/annotations.html#type-and-annotation-expressions?

@erictraut
Copy link
Collaborator

Do you mean this is covered in the grammar

Yes

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: typing specFor improving the typing specTyping Council decisionNeeds to be approved by the Typing Council. Do not merge until approved.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Is tuple allowed as an argument to type?

5 participants

@fangyi-zhou@encukou@erictraut@carljm@srittau