set using alternative hash function?
austin.bingham at gmail.com
Thu Oct 15 16:07:43 CEST 2009
On Thu, Oct 15, 2009 at 3:43 PM, Diez B. Roggisch <deets at nospam.web.de> wrote:
> The context-decider isn't the same thing because it isn't designed yet :)
> And most probably won't ever be. It's just the abstract idea that
> hashing/equality change for one object depending on the circumstances they
> are used in, and that one wishes that the decision what to use is as simple
> & transparent as possible.
Fair enough :)
> Your approach is certainly viable, but I guess the current
> set-implementation is optimized on working with __hash__ and __eq__ on
> objects because for these exist slots in the python object structure in C.
> So while you can implement your idea, you will end up passing wrappers as
> Chris & me proposed into the current set implementation.
Yes, I figured that the guts of set relied on particulars to which we
are not privy at the python level. If the syntax let me describe sets
the way I've been laying out here, I could probably tolerate the
underlying implementation relying on wrappers.
> However, it might be worth thinking of proposing this change to the set-type
> in general. But then for orthogonality, dicts should have it as well I
> guess. Which opens a whole new can of worms.
dicts would certainly have to be looked at as well, but I don't think
the can would have that many worms in it if we solve the set issue to
In any event, thanks for helping me work through this issue.
More information about the Python-list