I don’t want to use *args or **kwargs since I can’t change function declaration.
For example:
def foo( a, b, c ) """Lets say values passed to a, b and c are 1,2 and 3 respectively"""
...
...
""" I would like to generate an object preferably a dictionary such as {'a':1, 'b':2, 'c':3} """
...
...
Can anyone suggest a way to do this?
Thanks in advance.
If you can’t change the function “declaration” (why not?) but you can change the contents of the function, then just create the dictionary as you want it:
If that doesn’t work, I think you need a better explanation of what you want and what the constraints are in your case.
This is also going to give similar results in the above case (where you don’t show any local variables other than the arguments), but be warned that you should not try to modify locals():