This will do it:
inspect.getmembers(obj.__class__, lambda x: isinstance(x, property))
Here's how it works exactly (using IPython):
In [29]: class Foo(object):
....: @property
....: def foo(self): return 42
....:
In [30]: obj = Foo()
In [31]: inspect.getmembers(obj.__class__, lambda prop: isinstance(prop, property))
Out[31]: [('foo', <property at 0x106aec6d8>)]
This works because property
is a normal (new-style) class really; by marking something with @property
, you're just making an instance of property
. This also means that instances of properties (on a class) can be type-compared against property
using isinstance
.