how to annotate an argument that is supposed to be a class or its sub-classes ? Not using Union since this is not elegant.
Let's have a minimal example :
class Point:
def __init__(self,x,y):
self.x = x
self.y = y
class Segment(Point):
def __init(self,point1,point2):
self.p1 = point1
self.p2 = point2
def random_function(point_or_segment : Point_and_subclasses):
pass