Comment #1 on issue 3046 by smi...@gmail.com: divmod method needed for Rational
http://code.google.com/p/sympy/issues/detail?id=3046

https://github.com/sympy/sympy/pull/1054

When divmod(2, S(3)) is called, Python passes the call off to Integer.__rdivmod__ because S(3) is an Integer. The arguments __rdivmod__ receives are rdivmod(S(3), 2) -- note the reversal of arguments relative to the first call. Since there was no __rdivmod__ for anything but Integer, any call to divmod with python number first failed; since there was no __divmod__ written for anything but Integer, a call to divmod with the first argument anything but an Integer failed.

__rdivmod__ and __divmod__ are now defined in Number so Rationals and Floats now work, too. The Integer versions of __rdivmod__ and __divmod__ were left in place since they are about 2X faster.

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to