←back to thread

118 points _ZeD_ | 3 comments | | HN request time: 0.424s | source
Show context
zdimension ◴[] No.44537739[source]
Did not know that such things could be accomplished by registering a new file coding format. Reminds me of https://pypi.org/project/goto-statement/
replies(3): >>44538009 #>>44538014 #>>44540340 #
1. crabbone ◴[] No.44540340[source]
I think there's a package to treat Jupyter notebooks as source code (so you can import them as modules).

While the OP package is obviously a joke, the one with notebooks is kind of useful. And, of course, obligatory quote about how languages that don't have meta-programming at the design level will reinvent it, but poorly.

replies(2): >>44541430 #>>44543601 #
2. Y_Y ◴[] No.44541430[source]
You talking about this?

https://jupyter-notebook.readthedocs.io/en/stable/examples/N...

3. xg15 ◴[] No.44543601[source]
I'd argue "import from notebooks" is still only helpful in the "space bar heating" sense.

I think Notebooks are great for quick, "explorative" sketches of code. They are absolutely terrible for organizing "production" code.

I know it often happens that something starts in a notebook and then sort of morphs into a generic script or full-on application. But I think, this is usually the signal you should refactor, pull out the "grown" parts from the notebooks and organize them into proper Python modules.

If you have parts that are still experimental or explorative, consider importing your new modules into the notebook instead of the other way around.

Source: personal experience