[IPython-dev] cell magics
Sat Feb 16 19:52:24 CST 2013
On 2/16/13 7:35 PM, Thomas Kluyver wrote:
> On 17 February 2013 01:26, Jason Grout <firstname.lastname@example.org
> <mailto:email@example.com>> wrote:
> If you were going to use the name and the value, it would make sense
> to do:
> Yep, that's functionally equivalent to what we do at present.
> or even
> The list was to allow for multiple variables. You could have a special
> cased isinstance(input, str), but it's a bit unpythonic.
I see this syntax fairly often:
%R(input='myvar othervar thirdvar')
In fact, I got the code to parse that from the python library (IIRC):
input.replace(',', ' ').split()
So you could support:
* a string, variables delimited by commas or whitespace
* a list of strings
* a dictionary if you wanted to specify the R names
You could also do something like:
That's probably the most pythonic.
More information about the IPython-dev