Help with sympy, please

Fredrik Johansson fredrik.johansson at gmail.com
Sun Nov 18 20:28:30 EST 2007


On Nov 19, 2007 2:09 AM, Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
> On Sun, 18 Nov 2007 16:05:15 -0800, Dick Moores <rdm at rcblue.com>
> declaimed the following in comp.lang.python:
>
> > TypeError: unsupported operand type(s) for /: 'float' and 'Float'
> >
>         <blink><blink>
>
>         What restrictive system can't even coerce a Python float to their
> own internal data type?
>
>         Does that library have any functions for type conversion? Float(1)
> (or Float(1.0) ) perhaps?

Coercion works fine; the problem is that Float implements __div__ but
not __truediv__. It works if you don't import division from
__future__. If you do that, even Float / Float division ceases to
work. That is definitely a bug, but not as bad a bug as not being able
to coerce floats at all ;-)

Fredrik



More information about the Python-list mailing list