[IPython-User] $ sign is removed in magic function

Thomas Kluyver takowl@gmail....
Mon Jan 2 10:53:22 CST 2012

2012/1/1 Zoltán Vörös <zvoros@gmail.com>

> If I run this in an ipython shell as
> In [24]: %fimp foo.dat $123
> [u'foo.dat', u'123']
> i.e., the $ sign is removed. However, if I do this on the command line

The $ sign is part of the magic system, for dropping Python variables into
your commands, so you can do things like this:

In [5]: cmd = "math.factorial(100)"
In [6]: %timeit $cmd

When you do $3, it evaluates it as the integer literal 3.

It's replaced before the arguments are passed to your function, and there
isn't a way to override it from inside the function. Is there another
symbol you could use instead of $?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20120102/f9c44612/attachment.html 

More information about the IPython-User mailing list