[Python-Dev] Floor division

Armin Rigo arigo at tunes.org
Thu Jan 25 10:56:51 CET 2007


Hi Tim,

On Tue, Jan 23, 2007 at 05:14:29PM -0500, Tim Peters wrote:
> For some reason `decimal` implemented __mod__ as the proposed
> standard's "remainder" operation.  That's the immediate source of your
> surprise.  IMO `decimal` should not have implemented __mod__ at all,
> as Python's number-theoretic mod is not part of the proposed standard,
> is a poor basis for a floating-point mod regardess, and it was a
> mistake to implement decimal % decimal in a way so visibly different
> from float % float and integer % integer:  it confuses the meaning of
> "%".  That's your complaint, right?

Thanks for the clarification.  Yes, it makes sense that __mod__,
__divmod__ and __floordiv__ on float and decimal would eventually follow
the same path as for complex (where they make even less sense and
already raise a DeprecationWarning).


A bientot,

Armin.


More information about the Python-Dev mailing list