top | item 40677764

(no title)

AlexanderTheGr8 | 1 year ago

The article and comments debating best practices in notebooks remind me of the time I hosted a website from a jupyter notebook.

Technically, I was using gradio to create a localhost webpage and then piping it through cloudflare. The website would only work when the notebook was running on the cmd line of EC2. Hey if it works, it works! Notebooks allowed me to do a 2 week project in 2 hours.

Like most things, notebooks have their pros and cons. One of the biggest adv is very rapid experimentation. Even a regular script takes a while for python interpreter to run and that time (even if only a few seconds) adds up in lack of creativity ("Bret Victor - Inventing on Principle" [1]). And if your script is loading a big database, then notebook is a no-brainer.

One of the biggest disadv of notebook is mis-ordering. You are allowed to declare a variable in cell 3 and then go and use it in cell 2. Even worse, you can declare a variable in cell 3 and then delete cell 3 and still be able to use that variable. That I believe is the biggest dis-adv of notebooks. It adds way too many subtle errors. One way to bypass this is to write everything in functions - no global vars.

I am willing to accept the issue of mis-ordering in order to get rapid experimentation. It's subjective whether you think the pros outweight the cons. I definitely think they do.

[1] : https://www.youtube.com/watch?v=PUv66718DII&t=4s

discuss

order

abdullahkhalids|1 year ago

The online book I am writing is just a set of jupyter notebooks (with lots of code) that get converted to html and uploaded.

nottorp|1 year ago

> Notebooks allowed me to do a 2 week project in 2 hours.

So... your alternative framework was too enterprisey for your purposes?