The following class uses __dict__ to check class attribute:
class rec: pass # Empty namespace object rec.name = 'Bob' # Just objects with attributes rec.age = 40 # from w ww . ja va 2 s . co m d = list(rec.__dict__.keys()) print( d ) d = list(name for name in rec.__dict__ if not name.startswith('__')) print( d ) d = list(rec.__dict__.keys()) print( d )