r/IPython • u/CeramicVulture • Apr 02 '19
Markdown cells instead of Python comments?
I'm new to Jupyter. I code in Python and am wondering if there is a recommendation when to use Markdown cells and when to use comments in Python.
If I have comments in my Python code then why would I use Markdown cells as the purpose of both is to document what is going on.
Any best practice?
6
Upvotes
View all comments
Show parent comment
2
u/irregardless Apr 02 '19
To add to this, markdown cells are useful if you intend to publish or distribute the notebook. They're essentially mini word processors that allow for a more formal and sophisticated discussions of what a given code process does.
After using notebooks as code sketch pads for years, I've recently started putting markdown cells at the top of each one summarizing its purpose, use case, and/or development approach. That way, future-me has a little jump start remembering what a given notebook does.