jupyter_spaces icon indicating copy to clipboard operation
jupyter_spaces copied to clipboard

Request for hint/example (documentation issue)

Open rpgoldman opened this issue 1 year ago • 0 comments
trafficstars

Something I would often like to do with jupyter_spaces is to do a bunch of computation with temporary variables, and assign the final result to a persistent/global variable. Right not, I have been doing this by defining simple zero-argument functions that encapsulate all the computation in a cell, and then invoke that function to catch the result. Something like

def cellFunc() -> <result type>:
   .....
   return foo

result1 = cellFunc()

where result1 is what I would like to share with other cells.

I feel like this should be doable with jupyter_spaces, but I don't sufficiently follow the discussion of scoping in the readme. There it says that all assignments are in the local scope, so I think in my example, result1 will not be visible outside. I can't tell whether there's anything I can do to "declare" a value in global scope to smuggle values out of the cell.

rpgoldman avatar Apr 03 '24 15:04 rpgoldman