python check if object has __dict__ code example Example: python check if has attribute if hasattr(a, 'property'): a.property