snippets
filter:96 snippets
py-gen-dataclass·python·general
from dataclasses import dataclass
@dataclass(frozen=True)
class Point:
x: float
y: float
def distance(self, other):
return ((self.x - other.x) ** 2 + (self.y - other.y) ** 2) ** 0.5
py-gen-dataclass·python·general
from dataclasses import dataclass
@dataclass(frozen=True)
class Point:
x: float
y: float
def distance(self, other):
return ((self.x - other.x) ** 2 + (self.y - other.y) ** 2) ** 0.5