[IPython-user] Re: [IPython-dev] I need feedback: new escape for @magics?
Fernando.Perez at colorado.edu
Tue Oct 5 13:55:33 CDT 2004
Fernando Perez schrieb:
> Prabhu Ramachandran wrote:
>>% sounds good. The only thing to keep in mind is, is it possible to
>>use a magic in situations where '%' is not the first character? From
>>the discussions I assume not but are there future plans for requiring
>>such a thing?
> There isn't a really 'official' way to do so, but you can always do:
> __IP.magic_foo('bar baz')
> which is really what ipython does when you type
> foo bar baz
> at a prompt. I may introduce an ipmagic() true python function, injected by
> ipython into __builtin__ at startup, to do this:
> ipmagic('foo','bar baz')
> which would expose this interface more cleanly. This would give a user-level
> mechanism for calling magics anywhere without having to rely on name mangling
> tricks (which will not be valid for long, as I intend to clean that mess up soon).
I've committed to CVS the change @ -> %, and I also added this ipmagic()
function, in case you need to call magics inside any compound statement or via
a script you want to execute through %run. I think this is a useful addition.
I'm waiting on the 2-week period I said I'd give for the licensing change to
take effect, and we'll probably have ipython 0.6.4 out as a BSD-licensed,
Python 2.4-decorator-compatible release then :)
More information about the IPython-user