13 Jul 13:50
Re: Some starting-out IPython questions
From: Jörgen Stenarson <jorgen.stenarson <at> bostream.nu>
Subject: Re: Some starting-out IPython questions
Newsgroups: gmane.comp.python.ipython.user
Date: 2008-07-13 11:50:14 GMT
Subject: Re: Some starting-out IPython questions
Newsgroups: gmane.comp.python.ipython.user
Date: 2008-07-13 11:50:14 GMT
Fernando Perez skrev: > On Sat, Jul 12, 2008 at 3:27 PM, Dick Moores <rdmoores <at> gmail.com> wrote: > >> Ah. Nice. But another problem. I can't read the unit of time. See >> attached image. > > That character is a 'mu' for microseconds. I don't know why it > doesn't display correctly under windows though. We could be > mis-encoding it, or it could be a font issue with the windows console. > Someone more knowledgeable than me on all things win32 may be able to > help here. > Hi, I believe the reason is that the reportstring for the timeit magic function is built from regular strings and not unicode strings. I have attached a patch that works on windows for me. /Jörgen
=== modified file 'IPython/Magic.py'
--- IPython/Magic.py 2008-07-06 16:54:20 +0000
+++ IPython/Magic.py 2008-07-13 11:45:55 +0000
@@ -1755,7 +1755,7 @@
import timeit
import math
- units = ["s", "ms", "\xc2\xb5s", "ns"]
+ units = [u"s", u"ms", u"\xb5s", u"ns"]
scaling = [1, 1e3, 1e6, 1e9]
opts, stmt = self.parse_options(parameter_s,'n:r:tcp:',
@@ -1804,7 +1804,7 @@
order = min(-int(math.floor(math.log10(best)) // 3), 3)
else:
order = 3
- print "%d loops, best of %d: %.*g %s per loop" % (number, repeat,
+ print u"%d loops, best of %d: %.*g %s per loop" % (number, repeat,
precision,
best * scaling[order],
units[order])
_______________________________________________ IPython-user mailing list IPython-user <at> scipy.org http://lists.ipython.scipy.org/mailman/listinfo/ipython-user
RSS Feed