In Python this will be like so:
    
    
    from dataclasses import dataclass  # Python >= 3.7
    
    @dataclass
    class Point2D:
        x: float
        y: float
    
    def sumPoints(p1: Point2D, p2: Point2D) -> Point2D:
        x = p1.x + p2.x
        y = p2.y + p2.y
        return Point2D(x, y)
    
    print(sumPoints(Point2D(1.0, 2.0), Point2D(3.0, 4.0)))
    
    
    Run

Reply via email to