In Python code, I foudnd this line. What does it mean?
import attr
Here is an example:
import collections
import attr
import tensorflow as tf
Most probably it is using attr package Check https://www.attrs.org/en/stable/examples.html
attrs is the Python package that gives you a class decorator and a way to declaratively define the attributes on that class:. An example is given below:-
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
For a detailed explanation visit https://pypi.org/project/attrs/ .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.