0
点赞
收藏
分享

微信扫一扫

python中classmethod和 staticmethod

单调先生 2022-01-26 阅读 67
python


python中classmethod和 staticmethod_python

示例9-3 中的​​frombytes​​方法如下:

@classmethod   # 使用装饰器
def frombytes(cls,octets):
typecode = chr(octets[0])
memv = memoryview(octets[1:].cast(typecode)
return cls(*memv)

python中classmethod和 staticmethod_python_02



举报

相关推荐

0 条评论