关于Optional类型标注
class Dog(BaseModel): birthday: date weight: float = Optional[None] sound: List[Sound]
weight属性那行该怎么理解?
是不是该写成:
weight: Optional[float] = None
class Dog(BaseModel): birthday: date weight: float = Optional[None] sound: List[Sound]
weight属性那行该怎么理解?
是不是该写成:
weight: Optional[float] = None
2021-04-22
举报