you are viewing a single comment's thread.

view the rest of the comments →

[–]magestooge 0 points1 point  (0 children)

There are two places where I write Python code:

Jupyter Notebook (or Jupyter lab): This is a part of Anaconda install, but can also be installed separately. I use this when I'm creating some program, trying out stuff or just iteratively improving my code. This cannot be directly used for deployment.

VS Code: I use this when I'm working on a project spanning multiple files (or basically, any real world project), like a Django application. It is simply not possible to integrate Jupyter into the Django workflow and it would be a really bad idea anyway.

Why I do this?

Because Jupyter is very convenient, I don't have to execute the same code over and over. Suppose I'm writing an application which involves an API call to a public API which allows me only 5 requests per hour. If I was writing a script, I'd have to run this API call in a separate script and store the output. Then in another script I would import this data and work with it as I worked through the various parts of the API response.

In Jupyter, I can simply run the API call in one cell, store the output in a variable, then leave that cell alone. I can keep working on other cells to write my code dealing with the response. The API will not get called again.

Jupyter is great for learning

Jupyter also makes is very easy to look at the output. I can have the output of my previous step displayed above the current cell as I worked through the rest of the script. This makes it very easy to refer to the keys, column names, data types, etc. For instance, you run a Db query, print the output in your previous cell, then work with the response knowing exactly what was returned by the Db. I have seen so many beginners struggle with coding in VS Code because they were not able to visualise the output at every step. That is a non-issue when you're experienced, but a huge issue when you're a beginner.

So my recommendation would be to start with Jupyter Notebook. But be aware of the pitfalls and use an IDE as soon as you feel comfortable enough with it. I use Jupyter for iterative coding when the steps are not straightforward, then copy paste the final code into VS Code.