Mark Dickinson <dicki...@gmail.com> added the comment:

I'm not quite sure why `Fraction_instance % float_instance` wouldn't simply 
convert the `Fraction` to a `float` and then use the usual floating-point mod. 
There's the issue that you want to maintain consistency with the floordiv 
operation, but if `Fraction_instance // float_instance` _also_ converts its 
first argument to float, then that consistency should follow automatically.

That's the pattern that's followed for most of the other binary arithmetic 
operators. It looks like the inconsistency is caused by using 
`_operator_fallbacks` for most of the operations, but doing something more 
ad-hoc for modulo.

I agree that the current behaviour is surprising.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32968>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to