0

I would like to know if there is any method to check whether two functions have the same arguments at runtime in python 3.

Basically, I have this function (func) that takes another function and an argument. I want to check the values assigned to args in the lambda function

func(another_func, args):
   return lambda(x : another_func(x, args))

It is not feasible to run the code before and check the results because I am implementing a lazy framework. My main goal is to be able to understand what are the arguments of the function because there is one variable argument that I do not care but there is one static that is created before running the function.

##EDIT

I actually solved this problem using the inspect module (getclosure) for those who are interested!

1 Answers1

0

I actually solved this problem using the inspect module (getclosure) for those who are interested!

Extension (Martijn Pieters): I think you are referring to getclosurevars(). You can also just access function.closure, and access the value of each cell via its cell_contents attribute.

  • I think you are referring to [`getclosurevars()`](https://docs.python.org/3/library/inspect.html#inspect.getclosurevars). You can also just access `function.__closure__`, and access the value of each cell via its `cell_contents` attribute. – Martijn Pieters Nov 18 '20 at 12:34
  • Adding your comment to the answer. thanks! – Luis Enrique Pastrana Nov 18 '20 at 13:09