If I do in Jupiter (in both python and sage) something like:
a = 42b = 43a + b
it will, somehow, manage to understand that this process returns the value a + b
, i.e. 85 here:
Similarly, if I just do:
a = 42
it will understand that there is nothing to return.
I would like now to do something similar for a different application (to cache the result of a python operation)… how could I get this information, ideally by just running the code and appending some python code to obtain this information? I tried to do:
a = 42b = 43a + bprint(_)
but this fails. I was thinking to do something stupid like adding res =
in front of the last line, but it might fail for instance if the last line is indented etc… How can I elegantly obtain this information?