Re: storing variables *in* the notebook
Antonino Ingargiola <[email protected]> Thu, 26 Jan 2017 09:20:12 -0800
| Newsgroups | gmane.comp.python.ipython.devel |
|---|---|
| Message-ID | <CANn2QUwV9BudbVENLzp=b8xXdPgsVZ65UT+sFJBNii4OhUkFFw@mail.gmail.com> |
Hi Zoltan, just a simple comment. If the data is not big, why not copying it verbatim in a code cell? Even in a very long single line if you do not wish to clobber the visual aspect. That way the notebook would be self-contained. My 2-cents. Antonio On Wed, Jan 25, 2017 at 11:45 PM, Zoltán Vörös <[email protected]> wrote: > Hi Thomas, > > > Thanks for the comments! Here are mine. > > > On 01/25/2017 11:20 PM, Thomas Kluyver wrote: > >> On 25 January 2017 at 21:33, Zoltán Vörös <[email protected] <mailto: >> [email protected]>> wrote: >> >> Now, the standard answer to this problem is the %store magic, but >> that has at least two problems (one is actually more like a >> feature). First, as far as I understand, it saves the variable >> into a separate file, therefore, the notebook itself is not >> "portable" anymore: if I want to give it to someone, or use it on >> another computer, then I need the extra file, but then I could >> just save the variable in a file in the first place. >> >> >> In many cases, we think that the unit of sharing should be a directory >> containing notebooks and associated data files, rather than a notebook >> itself. Storing and retrieving data in a notebook would require breaking >> the abstraction that the code inside a notebook doesn't know about the >> document it's part of. >> > > But by the same token, by resorting to the %store magic, the code inside > the notebook is linked to something on the file system, in fact, > surreptitiously in a way. I am afraid, I don't quite see, why and how > %store is different in this respect. > > To me, one of the main appeals of the notebook is that one can write a > report/log (by this I mean create figures, do data analysis/simulation and > add context, explanation etc.) in a single document, portably, and without > clobbering the file system. I believe, the use case I mentioned earlier is > a logical extension of this concept. > > The over-arching theme of the whole ipython project is that data, > analysis, presentation and narrative should not be separated. Metadata are > routinely attached to markdown cells, so why could not be done the same for > the notebook as well? > > I understand that you do not want people to store GBs of data in the > notebook, but that was not the intent of the original question. > > > >> ActivePapers is a different take on connecting code and data which does >> package them in a single file; I believe it has some support for using a >> Jupyter notebook as part of an ActivePaper: >> https://github.com/khinsen/activepapers-python >> > > Thanks for the pointer, I will check it out! > > > Zoltán > _______________________________________________ > IPython-dev mailing list > [email protected] > https://mail.scipy.org/mailman/listinfo/ipython-dev > _______________________________________________ IPython-dev mailing list [email protected] https://mail.scipy.org/mailman/listinfo/ipython-dev