[IPython-user] alias / macro question

belinda thom bthom at cs.hmc.edu
Fri Dec 1 02:07:01 CST 2006


I would like to be able to bundle the following commands into a  
single command:

import <foo>; reload(<foo>); from <foo> import *

where <foo> is treated like an argument (its text value replaces foo).

At first I thought %alias might work, but alas, the manual tells me  
it is only for system shell commands.

Macro could be used, but I'd have to "remacro" every time I change  
foo. I'd also not be able to have this behavior bundled up when I  
first start ipython.

This kind of desired behavior seems pretty useful, so I'm wondering  
if ipython (or python) has something in place for this.

I'm still in the process of learning both python and ipython; thanks  
the help.

-b


More information about the IPython-user mailing list