[IPython-dev] what goes wrong with %%file
Bradley M. Froehle
brad.froehle at gmail.com
Mon May 13 01:00:00 EDT 2013
Hi,
On Sun, May 12, 2013 at 4:46 PM, Fernando Perez <fperez.net at gmail.com>wrote:
> On Sun, May 12, 2013 at 4:23 PM, Brian Granger <ellisonbg at gmail.com>
> wrote:
> > 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.
>
> No, nobody is trying to create an editor, it's just that the *name*
> can be improved, and that's all I think is within scope here. The
> function makes a (potentially destructive) action, so it should be
> named as a verb, much like %%load is. %%file is indeed ambiguous, and
> we have proven evidence of confusion, which we should take into
> account.
>
I agree with Fernando that the best course of action here might be to
rename `%%file` into something less ambiguous. If we go down that road, I
agree that at a minimum the name should be a verb which indicates that it
will write to a file. Bonus points if it also indicates that the cell
contents are what will be written to the file.
The suggested verbs I've seen so far are `save`, `write`, and `overwrite`.
Each of these could then be decorated with `file` or `f` (or `cell`) to
increase the specificity. Unfortunately there isn't a good shell analogue
to draw from here; the closest function would be `tee` which is very unix-y
and not even perfect metaphor.
Using `%%save` is problematic because there is already a different semantic
meaning associated with `%save`.
So, my vote would be for one of the following:
* %%write
* %%fwrite
* %%writelines
* %%writecell
-Brad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20130512/a321cb69/attachment.html>
More information about the IPython-dev
mailing list