[Python-3000] callable()

Gareth McCaughan gmccaughan at synaptics-uk.com
Wed Jul 26 16:47:41 CEST 2006


On Wednesday 2006-07-26 07:20, Greg Ewing wrote:
> Andrew Koenig wrote:
> > I think of a
> > function f as being idempotent if f(x) == x for all x in dom(f).
> 
> Um, that's an identity function, isn't it? I think
> you mean something more like f(f(x)) == f(x).
> 
> But even that's not quite what we're talking about
> here, because we're not hashing the result of the
> hash function. If idempotency is involved it's
> about side effects rather than the return value.
>  From a functional point of view, the hash value
> of a given object should simply be constant.

What needs to be idempotent -- i.e., to satisfy f(f(x))==f(x) --
is the function (from states of the world to states of the world,
suitably abstracted) that describes the total effect of calling
the hash function.

-- 
g



More information about the Python-3000 mailing list