News for hackers. Stuff that matters.
Re:What’s wrong with computational notebooks? by IanCal on Monday January 27, 2020 @07:24PM (#22165247)
If people are wondering about cases that can cause this - a common one (for me) is a mis-spelled variable name. If you go back and change it, the old one is still there and if you make the same mistake twice you will have code that runs but doesn't work. It's then really not obvious why it doesn't work.
Re:What’s wrong with computational notebooks? by sillysaurusx on Monday January 27, 2020 @08:37PM (#22165663)
It's best to think of the notebook as a REPL. So you'd want to run `del foo` on the old name.

In fact, this is a good counterexample. Why should the notebook delete the old variable name? What if its value is a thread currently executing?

Notebooks are REPLs, and it's better to get used to that than to try to enforce some confusing time traveling.

Re:What’s wrong with computational notebooks? by tgb on Monday January 27, 2020 @09:12PM (#22165790)
But, strangely, Jupyter doesn't also give you a REPL (like, say, R Studio does). I'm always making new cells in the middle to output the column names of my spreadsheet, and then I have to delete them. I used to just always have an ipython REPL running and test things out in there as I write. You can start a ipython instance on the same kernel but I found that messed up my plots when I did that IIRC.
Re:What’s wrong with computational notebooks? by ivirshup on Monday January 27, 2020 @09:59PM (#22166038)
You can get a REPL attached to a notebook in jupyter. When you open a console in jupyter-lab you have the option of attaching it to an already running kernel. Using the notebook interface you can connect a console using `jupyter console --existing`. By default this connects to the most recent session, but you can also specify a session by passing a token.
Re:What’s wrong with computational notebooks? by tgb on Thursday January 30, 2020 @07:11AM (#22190794)
Yeah, but problems with that are what my last sentence referred to. I didn't try debugging it for long, though.
Re:What’s wrong with computational notebooks? by SiempreViernes on Tuesday January 28, 2020 @06:31AM (#22168394)
Just get the extension: https://jupyter-contrib-nbextensions.readthedocs.io/en/lates...

there are quite a few very useful ones, my favourite being collapsible headings: https://jupyter-contrib-nbextensions.readthedocs.io/en/lates...

Re:What’s wrong with computational notebooks? by sillysaurusx on Monday January 27, 2020 @09:25PM (#22165867)
Yes! I've wanted this too.

Colab has a nice feature that's close to this: Insert -> Scratch code cell

Re:What’s wrong with computational notebooks? by IanCal on Monday January 27, 2020 @10:03PM (#22166055)
> It's best to think of the notebook as a REPL.

With sections of the history easily replaced.

> So you'd want to run `del foo` on the old name.

And then delete this line, because if you leave it in it'll break when you try and run the file all the way through.

> Notebooks are REPLs, and it's better to get used to that than to try to enforce some confusing time traveling.

Do you mean by treating them as append only and never rerunning any cells?

> In fact, this is a good counterexample. Why should the notebook delete the old variable name? What if its value is a thread currently executing?

The notebook has no idea if it can or can't, but that doesn't mean that leaving it in is good it's simply the only realistic option.

Re:What’s wrong with computational notebooks? by antipaul on Monday January 27, 2020 @09:18PM (#22165831)
Agree. Get used to the habit of deleting old objects/names when you are replacing them, if you work in notebooks
Re:What’s wrong with computational notebooks? by IanCal on Monday January 27, 2020 @10:05PM (#22166066)
It's an easy thing to miss though, because you also then need to delete the line of code you used to delete the old object/name so you have no record of cleaning up after yourself.