How can I determine the property attributes on a class or instance?

mrdylan micah.dylan at gmail.com
Tue Apr 11 22:11:46 EDT 2006


Given a class like so:

-------------------------------
class TestMe(object):
  def get(self):
    pass
  def set(self, v):
    pass

  p = property( get, set )

t = TestMe()
type(t.p)         #returns NoneType, what???
t.p.__str__      #returns <method-wrapper object at XXXXXXX>
-----------------------------------

What is the best way to determine that the attribute t.p is actually a
property object? Obviously I can test the __str__ or __repr__
attributes using substring comparison but there must be a more elegant
idiom.

thanks!




More information about the Python-list mailing list