I want to get all the properties of an object, and with this I mean only methods decorated with @property
.
Answers to similar questions like here return all attributes and/or methods without filtering those which are properties.
I want to get all the properties of an object, and with this I mean only methods decorated with @property
.
Answers to similar questions like here return all attributes and/or methods without filtering those which are properties.
I don't know what is the expected result you want, but you can filter the methods that are from the class property
. For example:
class A:
def bla(self):
pass
@property
def ble(self):
pass
list(
filter(
lambda f: isinstance(f[1], property),
vars(A).items()
)
)
# Result
# [('ble', <property at 0x7f01149074a8>)]