-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
I expected types to be promoted to sub-types within an issubclass
block, the same as instances within an isinstance
block, but type-checking the following code results in the error Type[Vehicle] has no attribute "wheels"
:
from typing import Type
class Vehicle(object):
name = ''
class Car(Vehicle):
wheels = 4
def test_isinstance(x):
# type: (Vehicle) -> None
print(x.name)
if isinstance(x, Car):
print(x.wheels)
def test_issubclass(x):
# type: (Type[Vehicle]) -> None
print(x.name)
if issubclass(x, Car):
print(x.wheels)
Is this be possible or am I missing something? I'm testing against the master branch.