[IPython-dev] what goes wrong with %%file

Thomas Kluyver takowl at gmail.com
Sun May 12 18:28:17 EDT 2013


Not convinced by %%overwrite:
- It doesn't make much sense when the file doesn't already exist
- It should be usable the other way round as well - you know what you want
to do (save some text to a file), find the quickest way to do that.

My vote would be %%writefile.

Thomas


On 12 May 2013 22:56, Greg Wilson <gvwilson at third-bit.com> wrote:

> On 2013-05-12 5:33 PM, Fernando Perez wrote:
> > Mmh,  %%overwrite... I didn't like it too much when I first saw it,
> > but it's growing on me, and it has the advantage of being unambiguous
> > about the destructive nature of the action.
> >
> Could we do a simple usability test in the spirit of
> http://mail.python.org/pipermail/python-dev/2000-July/006427.html and
> http://mail.python.org/pipermail/python-dev/2000-July/006098.html to
> find out what users would expect each alternative to do? I've included a
> very rough first cut below (which looks better with a monospaced font :-)
> Thanks,
> Greg
>
> --------------------
>
> You have a directory called 'data' that contains two files:
>
> * 'fish.csv' contains 160 lines of observations in comma-separated
>    values format.
> * 'site.txt' contains 20 lines of text describing the site where you
>    collected data (in plain English).
> * 'weather.txt' contains half a dozen lines of text about the weather
>    during your site visit.
>
> You run the IPython Notebook in that directory and do the operations
> described below.  What does the Notebook display when each cell
> command is run (in the order shown, with all of the cell content typed
> in before the cell is run), and what changes does it make inside the
> 'data' directory and/or the files it contains when each cell is run?
>
> 1. +----------------------------------------+
>     |%%load fish.csv                         |
>     +----------------------------------------+
>
> 2. +----------------------------------------+
>     |%%display fish.csv                      |
>     +----------------------------------------+
>
> 3. +----------------------------------------+
>     |%%file site.txt                         |
>     +----------------------------------------+
>
> 4. +----------------------------------------+
>     |%%file weather.txt                      |
>     |Generally sunny, but on the last day    |
>     |we had torrential rain followed by a    |
>     |meteorite shower.                       |
>     +----------------------------------------+
>
> 5. +----------------------------------------+
>     |%%overwrite site.txt                    |
>     +----------------------------------------+
>
> 6. +----------------------------------------+
>     |%%overwrite site.txt                    |
>     |Typical riverbank site, some signs of   |
>     |recent erosion due to road-building,    |
>     |plus traces of metallic iridium left    |
>     |behind by the mothership.               |
>     +----------------------------------------+
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20130512/791b1618/attachment.html>


More information about the IPython-dev mailing list