hash values and equality

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri May 20 20:47:56 EDT 2011


On Fri, 20 May 2011 21:17:29 +0100, MRAB wrote:

> On 20/05/2011 20:01, Christian Heimes wrote:
>> Am 20.05.2011 17:50, schrieb MRAB:
>>> Is this strictly true? I thought that the hash value, an integer, is
>>> moduloed (Is that how you spell it? Looks weird!) ...
>>
>> I don't think 'moduloed' is an existing word but your description is
>> mostly correct. ...
>>
> A brief search on the web found a use of the word in 1982.

All that means is that two people, three decades apart, used the same non-
word :)

I think you are treating "modulo" as a verb, equivalent to division, 
hence:

a/b => a is divided by b
a%b => a is "moduloed" by b

But modulo is not a verb. It is a preposition, a modifier word. Just as 
you might say "the cat sat on the mat" (cat on mat) or "the Princess 
found a pea underneath her mattress" (pea underneath mattress) so 
mathematicians will say "a is taken modulo b" (a modulo b).

English verbs nouns at the drop of a hat, but I've never heard of it 
verbing propositions:

"The princess underneathed the pea."

No, I don't think so.

English does use "remainder" as a verb, although not in the mathematical 
sense; I think that:

a%b => a is remaindered by b

is at least grammatical, although still ugly and awkward. I'm afraid that 
in English, the best way to say what you are trying to say is moderately 
verbose:

"the hash value, an integer, is taken modulo ..."


-- 
Steven



More information about the Python-list mailing list