from bakery import assert_equal
from dataclasses import dataclass
@dataclass
class Rectangle:
length: int
width: int
def area(rect: Rectangle) -> int:
return rect.length * rect.width
box = Rectangle(5, 3)
assert_equal(area(box), 15)
I am getting confused which is function here and which is a class. What is the decorator here?
Can somebody please explain this in simple words?