python find the type of a function
问题 I have a variable f. How can I determine its type? Here is my code, typed into a python interpreter, showing that I get an error using the successful pattern of the many examples I have found with Google. (Hint: I am very new to Python.) >>> i=2; type(i) is int True >>> def f(): ... pass ... >>> type(f) <class 'function'> >>> type(i) <class 'int'> >>> type(f) is function Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'function' is not defined >>> f=3 >>