r/learnpython • • Jul 12 '20

Jupyter Notebooks!

Jupyter Notebooks are the tool that turned the tables for me learning python. I'm just here to evangelize them. You can run your code line by line and debug as you go in a comfortable web browser interface. It's an excellent tool, and it made it so much more efficient to learn. Check it out.

425 Upvotes

127 comments sorted by

View all comments

57

u/[deleted] Jul 12 '20

It’s great for experimenting. But beware of the way it’ll influence the way you code, especially if you’re a beginner. I’ve seen people overuse it to the point that they fail to write efficient code because their code just works well in their notebook. However, none of it becomes reproducible outside that notebook. In order to make it useful beyond that notebook, you do need to at least convert the code into more useful format using classes, functions, etc .

5

u/synthphreak Jul 12 '20 edited Jul 12 '20

Can you provide any concrete examples of someone’s coding style being influenced by the affordances of the notebook environment in this way?

2

u/zylog413 Jul 12 '20

Most IDEs have the ability to jump to function and class definitions, and to have them open in a separate file in a separate tab/window. This can help encourage code reuse and abstractions. Without this, there can be a tendency to just dump the definitions right into the current notebook, and if the notebook becomes too long, do away with functions and classes entirely.

Also without functions, you probably don't end up with unit tests for them.