mrdylan wrote: > 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.
Check the class instead of the instance: >>> type(TestMe.p) <type 'property'> >>> type(t.__class__.p) <type 'property'> >>> isinstance(t.__class__.p, property) True --Ben -- http://mail.python.org/mailman/listinfo/python-list