In the question How can I find the number of arguments of a Python function? code is given showing how to using inspect.getfullargspec
to get information of a function. However, is there any way to verify whether one of the arguments for the function is self
? Is it possible to identify if the first method argument is self
Python 2, by somehow check if the first argument of a given function is a reference to the method's object?
For example, the first argument in the function step
is technically self
even though someone has decided to be evil and rename self
to what
.
class TestNode(object):
def __init__(what, bias=0):
what.bias = bias
def update(what, t, x):
return t / x * what.bias
However, the first argument in the function lambda self: self+1
despite someone being evil and naming an argument self
is not actually the self
using in Python objects.