在Python代码中,我找到了这一行。什么意思?
import attr
下面是一个示例:
import collections
import attr
import tensorflow as tf
发布于 2020-06-10 06:33:42
它很可能正在使用attr package Check https://www.attrs.org/en/stable/examples.html
发布于 2020-06-30 18:09:13
attrs是一个Python包,它为您提供了一个类装饰器和一种在该类上声明性定义属性的方法:。以下是一个例子:
import attr
@attr.s
class SomeClass(object):
a_number = attr.ib(default=42)
list_of_numbers = attr.ib(factory=list)
def hard_math(self, another_number):
return self.a_number
+sum(self.list_of_numbers) *
another_number
有关详细解释,请访问https://pypi.org/project/attrs/。
https://stackoverflow.com/questions/62279763
复制相似问题