set using alternative hash function?

Austin Bingham austin.bingham at
Fri Oct 16 07:09:53 CEST 2009

On Thu, Oct 15, 2009 at 8:10 PM, Anthony Tolle <anthony.tolle at> wrote:
> I think that without a practical example of what this would be used
> for, we're all going to be a little lost on this one.
> So far, we've not seen the original problem, only the author's
> preferred method for solving it.  My guess is there are other, more
> pythonic ways to solve the original problem.

The original problem was just a question statement: can I use
alternative uniqueness functions on a set? Indeed, I proposed an idea,
which that was sets could be constructed with user-defined hash and
equality functions, the strengths and weaknesses of which have been
gone over in some detail. The short answer is that what I was looking
for (admittedly, a desire motivated by experiences in other languages)
is not really feasible, at least not without a great deal more work.

The other proposed solutions all require linearly extra storage,
linearly extra time, both, or simply don't solve the problem. And in
any event, they miss the point of the original post which was not "How
can I get a particular behavior?" (which is fairly trivial, both in my
own estimation and as evidenced by the abundance of proposals) but
"Can I get a particular behavior in a particular way?" (the answer to
which, again, seems to be no.)


More information about the Python-list mailing list