8 Feb
2013
8 Feb
'13
10:06 a.m.
2013/2/8 Stefan Behnel
Hi,
I'm wondering about the purpose of this code in inspect.Signature.from_function():
""" if not isinstance(func, types.FunctionType): raise TypeError('{!r} is not a Python function'.format(func)) """
Is there any reason why this method would have to explicitly check the type of its argument? Why can't it just accept any object that quacks like a function?
The signature() function checks for types.FunctionType in order to call Signature.from_function(). How would you reimplement that? -- Regards, Benjamin