Using default uuid value in Python dataclasses

后端 未结 0 487
时光说笑
时光说笑 2020-12-01 17:30

If I execute the following:

@dataclass
class Test:
    hi: Optional[str] = field(
        default_factory=lambda: str(uuid.uuid1()))

@dataclass
class Test2:
         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题