Skip to main content

annotation_is_class

Test if a given annotation is a class that can be used in isinstance()/issubclass().

def annotation_is_class(
annotation: typing.Any
) - > bool

Test if a given annotation is a class that can be used in isinstance()/issubclass().

Parameters

NameTypeDescription
annotationtyping.AnyThe type hint or object to evaluate for class compatibility

Returns

TypeDescription
boolTrue if the annotation is a valid class for type checking, False if it is a generic type hint or other non-class object