def get_class_members(klass):
    ret = dir(klass)
if hasattr(klass, '__bases__'):
    for base in klass.__bases__:
        ret = ret + get_class_members(base)
return ret

def uniq(seq):
    """ the 'set()' way ( use dict when there's no set ) """
return list(set(seq))

def get_object_attrs(obj):
    ret = dir(obj)
if hasattr(obj, '__class__'):
    ret.append('__class__')
ret.extend(get_class_members(obj.__class__))
ret = uniq(ret)
return ret
How to get a complete list of object's methods and attributes?