get only values with @property wrapping from a python class

34 Views Asked by At

I have a class that uses variables which have to be accessed by another class in a separate module. I therefore used the @property decorator to make these properties accessible. I would like, however, to have a method to retrieve these properties, preferably in a dictionary with {"Property Name":Value} for all the variables wrapped in @property decorators.

I saw from a similar post, that the dir() and inspect.getmembers() calls can be used, but these draw out all the attributes of the class. I only want to retrieve those wrapped in the @property decorators.

Thank you.

0

There are 0 best solutions below