reactivepy icon indicating copy to clipboard operation
reactivepy copied to clipboard

Update value of displayed variable which is also set atomically in the same cell

Open psychemedia opened this issue 6 years ago • 2 comments

One of the demos folk use to show how trad kernel state differs from cell output is to show that the output from a cell of the form:

a=1
a

is incorrect if you update a.

But in reactivepy kernel, if I update a then the output of the original cell can become nonsense...

reactivepy

I suspect folk who have a reason for why notebooks don't work in their situation will pick up on this.

psychemedia avatar Dec 12 '18 15:12 psychemedia

FWIW, I'm not saying above behaviour is incorrect; just that docs should be upfront about the possibility / likelihood of situations like the above occurring and providing a straightforward way of interpreting that sort of situation (eg "this situation shows that the state of a has been changed elsewhere in the notebook since this cell was executed". It also makes the point that the cell is NOT executed? And makes me think - would it be useful to record the output of the cell when it is run for the first time, in order, from a fresh kernel, in metadata?)

In terms of advocacy, comparing "pathological" situations in reactivepy or simple Python kernel with the corresponding behaviour using the other / complementary kernel might be useful.

psychemedia avatar Dec 12 '18 18:12 psychemedia

I just tried doing this in the binder examples, and now get a RedefiningOwnedCellException exception - it seems you can't re-define variables if they are defined in earlier cells. Looks like this has been a feature for a while though (#10), so not sure if I've missed a key point here @psychemedia?

pelson avatar Dec 31 '18 09:12 pelson