[Numpy-discussion] Re: numpy, overflow, inf, ieee, and rich , comparison

Steve Williams sandj.williams at gte.net
Sat Oct 28 00:15:43 EDT 2000


Johann Hibschman wrote:

> Darren New writes:
>
> > Alex Martelli wrote:
> >> mod (ideally) for truncating division
> >> remainder (currently existing but spelled %)
>
> > Better than spelling it with the *wrong* name. Why spell "remainder" as
> > "mod", which implies it is "modulo" when it isn't? Personally, I've never
> > found a need for "remainder" and often found a need for "modulo" and had to
> > fix it every time those two differ.
>
> What's 'remainder', if not the same as 'modulo'?  I understand both of
> those terms to mean "least positive residue".  Unfortunately python
> doesn't do this for negative divisors, which is a bit of a glitch.
>

[snip]

Look, it's Friday night, and I've had a long week fixing legacy code from thirty
years ago.

1)    The problem is not with the operator / or %, it's with the target.  What do
I want as a result?

    If I want an integer result, I specify an integer target.  If I want float, I
float.

    Unfortunately, Python doesn't like typing all that much.  So it has to do
some indirect magic with the operator.

    That's OK.  We can all live with that.  When we debug our hours = seconds /
3600 code once again this week, we chuckle and shake our heads.

2)    COBOL, that ancient, unworthy, Dijkstra mental aberration, says something
like

        divide a by b remainder in c.

    What a sad language.






More information about the Python-list mailing list