[IPython-dev] cell magics
Sun Feb 17 18:50:51 CST 2013
I apologize that I don't have much time to participate in this
discussion, but I will try to summarize my thoughts.
* I don't think that changing IPython's line/cell magic syntax is on
table right now.
* I think the syntax you are proposing has a leaky abstraction that
will come back to bite you:
By having the syntax 1/2 python and 1/2 unrestricted strings, you are
going to be continually forced to make decisions about which things go
Why not this:
%timeit() -n1 -r1 myfunction()
* I also think your proposed syntax completely misses the point of
magics - namely to allow non-python syntax for quick and easy
interactive usage. If you are not doing that with magics, then why
not just use pure python and regular functions/classes with no "%" at
* I agree with the namespace pollution thoughts that Fernando mentioned.
On Sat, Feb 16, 2013 at 5:52 PM, Jason Grout
> On 2/16/13 7:35 PM, Thomas Kluyver wrote:
>> On 17 February 2013 01:26, Jason Grout <email@example.com
>> <mailto:firstname.lastname@example.org>> 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:
> %R(myvar=myvar, othervar=othervar)
> That's probably the most pythonic.
> IPython-dev mailing list
Brian E. Granger
Cal Poly State University, San Luis Obispo
email@example.com and firstname.lastname@example.org
More information about the IPython-dev