[IPython-dev] what goes wrong with %%file
Fernando Perez
fperez.net at gmail.com
Wed May 15 17:31:40 EDT 2013
On Tue, May 14, 2013 at 12:35 PM, Brian Granger <ellisonbg at gmail.com> wrote:
> 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).
While I remember liking %%file when we had the initial naming
discussions on this for these same reasons, unfortunately we have
evidence that users do get confused by this. I've had the same
question asked during teaching workshops over the last few months.
If it's really confusing lots of users, we should find a way to
mitigate that instead of having to answer this same question til the
end of days.
> The name "%%fwrite" requires users to make the non-obvious conceptual
> jump that "f" = "file". That is a step back.
Agreed, too cryptic.
> 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)
Given that in python, the actual lingo uses 'write' (as in open('foo',
'w') and f.write() ), I think that writefile is probably my favorite
choice. Starting with the word file helps a tiny bit
discoverability/tab completion, but I also agree that a more natural
reading probably outweighs that.
>From everything we've seen so far, I'm leaning towards `writefile`,
which should really be completely unambiguous to anyone and should
clear this source of confusion once and for all.
f
More information about the IPython-dev
mailing list