如何在数据类中拥有一个功能的现场占位符
考虑一下休假:
我有一个数据类,其中一个字段将来会收到一个功能。
我应该将哪种类型声明变量? 另外,我将其设置为init值,这是正确的事情吗?
@dataclass
class SystemIpMember:
name: str
ip: str
verify_func: ??? = None
online: bool = False
谢谢!
Consider the fallowing:
I have a data class and one of the fields will receive a function in the future.
What type should I declarer the variable?
Also, I set a value of None as the init value, is that the right thing to do?
@dataclass
class SystemIpMember:
name: str
ip: str
verify_func: ??? = None
online: bool = False
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如麦克斯所说的那样,我使用了“可叫”
As Max Stated, I used "Callable"