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

Brian Granger ellisonbg at gmail.com
Sun May 12 19:23:31 EDT 2013


It feels like we are trying to create a mini file editor in a notebook
cell.  %%file and friends are not supposed to be that in any way.  I
think %%file with prompting the user for overwrite is sufficient for
this particular purpose = write and store simple files in the
notebook.

On Sun, May 12, 2013 at 4:20 PM, Brian Granger <ellisonbg at gmail.com> wrote:
> I haven't following this too closely, but my initial thought is that
> all of this is sounding too complex.  Let's keep it simple -
> remembering that the notebook app will eventually have a full blown
> file editor in a separate window.
>
> On Sun, May 12, 2013 at 3:38 PM, Matt Davis <jiffyclub at gmail.com> wrote:
>> I agree with Thomas that %%overwrite won't be a natural choice when the file
>> doesn't already exist. I think %%filesave or %%writefile would be good
>> choices.
>>
>> - Matt
>>
>>
>> On Sun, May 12, 2013 at 3:28 PM, Thomas Kluyver <takowl at gmail.com> wrote:
>>>
>>> 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
>>>
>>>
>>>
>>> _______________________________________________
>>> IPython-dev mailing list
>>> IPython-dev at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>>
>>
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>
>
>
>
> --
> Brian E. Granger
> Cal Poly State University, San Luis Obispo
> bgranger at calpoly.edu and ellisonbg at gmail.com



-- 
Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu and ellisonbg at gmail.com



More information about the IPython-dev mailing list