[Numpy-discussion] sign of modulo

Warren Focke focke at SLAC.Stanford.EDU
Fri Oct 12 18:03:10 EDT 2001

On Fri, 12 Oct 2001, Eric Nodwell wrote:
> > Numpy delegates to the C platform's / and % operators, Python does it
> > "right".
> Wouldn't it be preferable to change Numpy so it is also "right"?

Speed.  In Python, there's so much overhead from symbol resolution,
looking up __mod__s and __rmod__s and whatnot that the extra work is lost
in the noise.  Numpy would take a bigger hit when working with large
arrays.  One could always write python_compatible_div and
python_compatible_mod functions, if one wanted.  Could even submit a patch
to add them, if truly motivated.

Warren Focke

More information about the NumPy-Discussion mailing list