% is not an operator [was Re: Verbose and flexible args and kwargs syntax]

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Dec 14 07:32:34 EST 2011


On Wed, 14 Dec 2011 10:56:02 +0200, Jussi Piitulainen wrote:

> Steven D'Aprano writes:
>> On Mon, 12 Dec 2011 09:29:11 -0800, Eelco wrote:
>> 
>> [quoting Jussi Piitulainen <jpiitula at ling.helsinki.fi>]
>> >> They recognize modular arithmetic but for some reason insist that
>> >> there is no such _binary operation_. But as I said, I don't
>> >> understand their concern. (Except the related concern about some
>> >> programming languages, not Python, where the remainder does not
>> >> behave well with respect to division.)
>> 
>> I've never come across this, and frankly I find it implausible that
>> *actual* mathematicians would say that. Likely you are misunderstanding
>> a technical argument about remainder being a relation rather than a
>> bijunction. The argument would go something like this:
> 
> (For 'bijunction', read 'function'.)

Oops, you're right of course. It's been about 20 years since I've needed 
to care about the precise difference between a bijection and a function, 
and I made a mistake. And then to add to my shame, I also misspelt 
bijection.


> I'm not misunderstanding any argument. There was no argument. There was
> a blanket pronouncement that _in mathematics_ mod is not a binary
> operator. I should learn to challenge such pronouncements and ask what
> the problem is. Maybe next time.

So this was *one* person making that claim?

I understand that, in general, mathematicians don't have much need for a 
remainder function in the same way programmers do -- modulo arithmetic is 
far more important. But there's a world of difference between saying "In 
mathematics, extracting the remainder is not important enough to be given 
a special symbol and treated as an operator" and saying "remainder is not 
a binary operator". The first is reasonable; the second is not.


> But you are right that I don't know how actual mathematicians these
> people are. I'm not a mathematician. I don't know where to draw the
> line.
> 
> A Finnish actual mathematician stated a similar prejudice towards mod as
> a binary operator in a Finnish group. I asked him what is wrong with
> Knuth's definition (remainder after flooring division), and I think he
> conceded that it's not wrong. Number theorists just choose to work with
> congruence relations. I have no problem with that.

Agreed.

[...]
> (There is no way to make remainder a bijection. You mean it is not a
> function if it is looked at in a particular way.)

You're right, of course -- remainder cannot be 1:1. I don't know what I 
was thinking.


-- 
Steven



More information about the Python-list mailing list