>>>>> "Bengt" == Bengt Richter <[EMAIL PROTECTED]> writes:

    Bengt> I wonder if a dict with a general override hook for hashing
    Bengt> all keys would be useful.  E.g., a dict.__keyhash__ that
    Bengt> would take key as arg and default as now returning
    Bengt> key.__hash__() but that you could override. Seems like this

There would need to be an override hook for key comparison as well (I
suppose it always uses == operation now?). But yes, I think it would
be *much* more useful than any 'keytransform' feature - is there any
use for 'keytransform' feature apart from the uses that would be
better covered by hash/comparison hooks?

It would be lovely to have something like this in the stdlib (or
anywhere, for that matter). Think about the use cases for hashing via
by os.path.normcase, str.lower...

-- 
Ville Vainio   http://tinyurl.com/2prnb
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to