[IPython-dev] Feature request/how?

Charles Moad cmoad at indiana.edu
Mon Feb 21 08:46:59 CST 2005


I would like a new magic function, "time".  I am not quite ipython savvy 
enough yet to do this correctly I think.  Here is what I forsee.

In [1]: %time blah() # for example
Out[1]: 'Blah return value'
   Call took 0.432 seconds


The code I am thinking would be something like:

def magic_time(self,parameter_s=''):
	import timing
	timing.start()
	self.run_in_current(parameter_s) # ??? What here
	timing.finish()
	print '\n  Call took %.3f seconds\n' % (timing.milli / 1000.0,)

Thanks for any help you can give,
	Charlie




More information about the IPython-dev mailing list