I have something like:
from attr import attrs, attrib
@attrs
class Foo():
max_count = attrib()
@property
def get_max_plus_one(self):
return self.max_count + 1
Now when I do:
f = Foo(max_count=2)
f.get_max_plus_one =>3
I want to convert this to dict:
{'max_count':2, 'get_max_plus_one': 3}
When I used attr.asdict(f)
I do not get the @property
. I get only
{'max_count':2}
.
What is the cleanest way to achieve the above?