---------------------------------------------------------------------------
Python 3.1.3 (r313:86834, Nov 27 2010, 18:30:53) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import mpmath
>>> mpmath.mpf(1)/3
mpf('0.33333333333333331')
>>> mpmath.quad(mpmath.sin, [0,mpmath.pi])
mpf('2.0')
>>> mpmath.runtests()
mpmath imported from c:\source\mp\trunk\mpmath
mpmath backend: python
mpmath mp class: <mpmath.ctx_mp.MPContext object at 0x00EEE830>
mpmath version: 0.17-svn
Python version: 3.1.3 (r313:86834, Nov 27 2010, 18:30:53) [MSC v.1500
32 bit (Intel)]
test_basic_ops
add ok 0.0014477 s
add_misc ok 0.0005224 s
...
finished tests in 72.08 seconds
---------------------------------------------------------------------------
To avoid having two separate codebases, Python 2.4 compatibility had
to be dropped, so mpmath will require 2.5 or higher from now on.
I'm only aware of one remaining (minor) issue: many doctests won't
pass in Python 3 due to print statements and such in the doctests
themselves. This might obscure some real bugs exercised by the
doctests, of course. Does anyone know if there is a way to run 2to3 on
docstrings to save some trouble? It might be easy enough to fix them
by hand, though.
This is a major enough new feature that we probably should release a
version 0.17 almost immediately. Help testing would be very welcome
(both on Python 3 and on Python 2, to make sure the changes didn't
break anything). I haven't tested with gmpy yet.
Fredrik
How do you avoid having two codebases? Do you automatically pass things through 2to3?
>
> I'm only aware of one remaining (minor) issue: many doctests won't
> pass in Python 3 due to print statements and such in the doctests
> themselves. This might obscure some real bugs exercised by the
> doctests, of course. Does anyone know if there is a way to run 2to3 on
> docstrings to save some trouble? It might be easy enough to fix them
> by hand, though.
Maybe you should just replace
>>> print whatever
stuff
with
>>> str(whatever)
stuff
Although I suspect being able to pass doctests through 2to3 would be useful for other reasons too (I don't know if it's possible or not).
Aaron Meurer
After fixing the relative imports, it mostly came down to the following:
* writing print(x) instead of print x
* using list comprehensions instead of map
* inserting trivial aliases xrange = range, long = int, __bool__ =
__nonzero__, etc
Fredrik
Aaron Meurer
> I tested 2.6, 2.7, 3.1, and 3.2 on 64-bit Linux without gmpy, with
> gmpy, and with gmpy2. All tests pass successfully.
Excellent!
> Performance with Python 3.x was consistently better that with 2.x.
> Using gmpy, the improvement is almost 7%. Between 3.x and 2.7, the
> difference is 14%. Have you seen similar improvements on other
> platforms?
Sounds great. I haven't done any profiling yet.
Fredrik
Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups "mpmath" group.
> To post to this group, send email to mpm...@googlegroups.com.
> To unsubscribe from this group, send email to mpmath+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mpmath?hl=en.
>
Not yet.
Fredrik