1

For sake of code readability would be nice to have possibility to split cells within for instance "def" or "for loop". For instance:

def myfunction(a): #cell 1  <br />
  a=a+4 #cell 2  <br />
  a=a*10 #cell 3  <br />
  return a #cell 4  <br />

For instance: currently I have got more than 100 cells and I need to wrap a for loop around it. The only ways that I see so far are: either merge all cells or just export to normal python.

I was looking for some magic cells but nothing like this found. And this is how I will see that, so there is a magic %%Start. If we run cell with this magic keyword, then the code from now on is not executed but stored in somewhere (catche?). When we "run" a cell with magic word %%Stop then all the gathered code is run.

in that way still I have possibility to experiment with my code cell by cell and to run it as a whole (especially for big scripts in a loop or for complex scripts in "def").

Any ideas how to deal with that?

I am sure that I have mixed the basic idea of ipython and jupyter notebook ;), but still I am looking for the answer and solution. The only one I see now is to create my own magic keywords, but than one could be harsh to do.

Rahul Agarwal
  • 4,034
  • 7
  • 27
  • 51
dnorus
  • 11
  • 1
  • 1
    This is probably a duplicate of https://stackoverflow.com/questions/47841361/is-it-possible-to-split-a-jupyter-cell-across-cells-when-it-contains-a-function . The short answer is: this is not possible. You can't split code in a block across cells in Jupyter. – 9769953 Jul 08 '19 at 11:03

0 Answers0