📜  python C-like structs - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:22.380000             🧑  作者: Mango

代码示例2
from dataclasses import dataclass


@dataclass
class Point:
    x: float
    y: float
    z: float = 0.0


p = Point(1.5, 2.5)

print(p)  # Point(x=1.5, y=2.5, z=0.0)