Skip to content

Argument Clinic: fix bare "type" in annotations#112915

Merged
AlexWaygood merged 2 commits intopython:mainfrom
JelleZijlstra:baretype
Dec 10, 2023
Merged

Argument Clinic: fix bare "type" in annotations#112915
AlexWaygood merged 2 commits intopython:mainfrom
JelleZijlstra:baretype

Conversation

@JelleZijlstra
Copy link
Member

Bare "type" in annotations should be equivalent to "type[Any]"; see
https://discuss.python.org/t/inconsistencies-between-type-and-type/37404
and python/mypy#16366. It's better to use "type[object]", which is
safer and unambiguous.

Bare "type" in annotations should be equivalent to "type[Any]"; see
https://discuss.python.org/t/inconsistencies-between-type-and-type/37404
and python/mypy#16366. It's better to use "type[object]", which is
safer and unambiguous.
Copy link
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.

Looks like there's currently a few aliases we have that currently use type[Any], but could probably be type[object]. Could you change them as well, so we're consistent across Argument Clinic about this?

@AlexWaygood AlexWaygood merged commit 1f9cd3c into python:main Dec 10, 2023
@AlexWaygood
Copy link
Member

Thanks!

aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
Bare "type" in annotations should be equivalent to "type[Any]"; see
https://discuss.python.org/t/inconsistencies-between-type-and-type/37404
and python/mypy#16366. It's better to use "type[object]", which is
safer and unambiguous.
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
Bare "type" in annotations should be equivalent to "type[Any]"; see
https://discuss.python.org/t/inconsistencies-between-type-and-type/37404
and python/mypy#16366. It's better to use "type[object]", which is
safer and unambiguous.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants