Skip to content

Type[Any] and type are not equivalent #2655

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

Closed
roganov opened this issue Jan 7, 2017 · 0 comments
Closed

Type[Any] and type are not equivalent #2655

roganov opened this issue Jan 7, 2017 · 0 comments
Labels
bug mypy got something wrong priority-0-high

Comments

@roganov
Copy link

roganov commented Jan 7, 2017

From typing docs:

Type[Any] is equivalent to Type which in turn is equivalent to type, which is the root of Python’s metaclass hierarchy.

But this code produces error:

from typing import *
y: type
x: Type[Any] = y

error: Incompatible types in assignment (expression has type "type", variable has type Type[Any])

@gvanrossum gvanrossum added the bug mypy got something wrong label Jan 14, 2017
ddfisher pushed a commit that referenced this issue Mar 14, 2017
Fixes #2655

As discussed in typing docs, Type[Any] is equivalent to plain type. is_subtype was checking this only one side, here I add the opposite side.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong priority-0-high
Projects
None yet
Development

No branches or pull requests

3 participants