def hello(): print("Hi there!") if __name__ == '__main__': hello() print('dir(hello):\n',dir(hello)) print(hello.__name__) print('inquiry about attribute:',hasattr(hello,'numerical_value')) # since False, add the attribute: print(80*'-') print("setting a new attribute 'numerical_value' to value 101") setattr(hello,'numerical_value',101) print('dir(hello):\n',dir(hello)) print('inquiry about attribute:',hasattr(hello,'numerical_value')) print(hello.numerical_value)