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

Brian Granger ellisonbg at gmail.com
Tue May 14 15:35:32 EDT 2013


On Tue, May 14, 2013 at 11:27 AM, MinRK <benjaminrk at gmail.com> wrote:
>
>
>
> On Tue, May 14, 2013 at 12:23 AM, Fernando Perez <fperez.net at gmail.com>
> wrote:
>>
>> On Mon, May 13, 2013 at 8:30 AM, Brian Granger <ellisonbg at gmail.com>
>> wrote:
>> > I still favor %%file and adding the prompt to overwrite.
>>
>> We have clear evidence of repeated user confusion with this, and it's
>> an ambiguous name for something that's an action (and a potentially
>> destructive one, at that).  This is a case where user feedback (in
>> this case collected by Greg) is showing us there's a real usability
>> problem, we just need to fix it.
>
>
> Excluding every destructive consequence mentioned so far, since the empty
> cell issue is long-since addressed in master.
>
>>
>>
>> Furthermore, making it by default interactive is going to cause all
>> kinds of unexpected problems in automatically managed notebooks and
>> scripts that will now block a process when they try to open a prompt.
>
>
> That is true of all notebooks with interactive elements, what makes %%file
> special?

I agree - if a user wants to get rid of the interactive element for
these purposes, they can simply add the --overwrite flag.

>>
>> A rename to a verb term, along with the option of an interactive flag
>> for those who clearly want that mode (and hence aren't worried about
>> auto-execution) addresses cleanly both issues.
>
>
> so if it were called `fwrite` or `writefile`, it would be okay to clobber by
> default? Renaming it doesn't make it any less destructive, and the
> destructive behavior is still implicit.

My original intention with %%file is that people would never touch
these files through any other means, so the overwrite wouldn't be a
problem.  But upon further thinking, I agree with Min that
overwrite-by-default is just a bad idea.

> I don't think there's any value in a non-default interactive behavior -
> either clobbering by default is fine, or it is unsafe and should be
> confirmed - safety being non-default won't ever be used.

I agree.

> I'm fine renaming to `fwrite` without changing any behavior, if that makes
> more sense than prompting for overwrite, I'm just surprised that it seems
> to.

The name "%%file" is conceptually close to what the magic does = it
writes/saves/creates a *file*.  What you call the action
(write/save/create) is ambiguous, the end result (file) is not.  I
don't want to pick a name that emphasizes the ambiguous part of the
magic while underplaying the perfectly clear part (file).

The name "%%fwrite" requires users to make the non-obvious conceptual
jump that "f" = "file".  That is a step back.

If we do change the name (I am open to it but not thrilled about it) I
would prefer something that makes its purpose more obvious:

%%writefile
%%savefile

I also prefer names that order words in a grammatically sensible
manner (%%writefile rather than %%filewrite)

Cheers,

Brian

>>
>>
>> Cheers,
>>
>> f
>> _______________________________________________
>> 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



More information about the IPython-dev mailing list