[IPython-dev] timeit bug

Stefan van der Walt stefan at sun.ac.za
Fri Sep 15 04:53:41 EDT 2006


Hi all

Unfortunately, I don't seem to have permission to create tickets on
the ipython trac -- which is why I am re-posting this.  Has anyone
taken a look at it by any chance?

Regards
Stéfan

----- Forwarded message from Stefan van der Walt <stefan at sun.ac.za> -----

From: Stefan van der Walt <stefan at sun.ac.za>
To: ipython-dev at scipy.org
Subject: timeit bug
Date: Tue, 15 Aug 2006 19:13:50 +0200
User-Agent: Mutt/1.5.11
Message-ID: <20060815171350.GA32301 at mentat.za.net>

Hi all,

Can anyone confirm the following behaviour with the latest trunk?

In [1]: timeit print('x')
---------------------------------------------------------------------------
exceptions.NameError                                 Traceback (most recent call last)

/tmp/<ipython console>

/home/stefan/lib/python2.4/site-packages/IPython/iplib.py in ipmagic(self, arg_s)
    866         else:
    867             magic_args = self.var_expand(magic_args)
--> 868             return fn(magic_args)
    869
    870     def ipalias(self,arg_s):

/home/stefan/lib/python2.4/site-packages/IPython/Magic.py in magic_timeit(self, parameter_s)
   1677             for i in range(1, 10):
   1678                 number *= 10
-> 1679                 if timer.timeit(number) >= 0.2:
   1680                     break
   1681

/usr/lib/python2.4/timeit.py in timeit(self, number)
    159         gcold = gc.isenabled()
    160         gc.disable()
--> 161         timing = self.inner(it, self.timer)
    162         if gcold:
    163             gc.enable()

/tmp/<magic-timeit> in inner(_it, _timer)

NameError: global name 'x' is not defined

Regards
Stéfan

----- End forwarded message -----



More information about the IPython-dev mailing list