When developing and debugging with python/ipython repl, at some point I'd like to dump all the local variables in a function to the workspace to see what's going on. Suppose I have a function
def func():
a = "blablabla"
b = 1234
c = some_calculation_of_a_and_b(a,b)
dump_to_workspace(a,b,c) # is this possible?, or even more preferable:
dump_all_local_variables_to_workspace() # is this possible?
I hope to be able to run this in python/ipython:
>>> func()
>>> print a
"blablabla"
>>> print b
1234
>>> print c
some_calculated_value
I know two alternatives: (1) return the variables from the function [not good because I don't want to mess up with return value], and (2) save the data to a file on the disk [not convenient because it involve disk I/O with possibly large amount of data]. But those aren't as convenient most of the times. Is there a way to achieve the dumping directly?
Thanks a lot in advance!