Re: Any built-in ishashable method ?

Discussion in 'Python' started by Dave Angel, Jan 18, 2013.

  1. Dave Angel

    Dave Angel Guest

    On 01/18/2013 07:06 AM, Peter Otten wrote:
    > Jean-Michel Pichavant wrote:
    >
    >> That brings me to another question, is there any valid test case where
    >> key1 != key2 and hash(key1) == hash(key2) ? Or is it some kind of design
    >> flaw ?

    >
    > I don't think there is a use case for such a behaviour other than annoying
    > your collegues ;)
    >


    Beg to differ. Nothing wrong with getting the same hash on objects that
    compare different. It's called a hash collision, and is quite common,
    especially in large collections.

    The problem is the converse of this, where the objects compare equal,
    but they have different hashes.

    --
    DaveA
     
    Dave Angel, Jan 18, 2013
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dave Angel

    Re: Any built-in ishashable method ?

    Dave Angel, Jan 18, 2013, in forum: Python
    Replies:
    0
    Views:
    128
    Dave Angel
    Jan 18, 2013
  2. Peter Otten

    Re: Any built-in ishashable method ?

    Peter Otten, Jan 18, 2013, in forum: Python
    Replies:
    0
    Views:
    132
    Peter Otten
    Jan 18, 2013
  3. Terry Reedy

    Re: Any built-in ishashable method ?

    Terry Reedy, Jan 18, 2013, in forum: Python
    Replies:
    0
    Views:
    126
    Terry Reedy
    Jan 18, 2013
  4. Peter Otten

    Re: Any built-in ishashable method ?

    Peter Otten, Jan 18, 2013, in forum: Python
    Replies:
    0
    Views:
    129
    Peter Otten
    Jan 18, 2013
  5. Steven D'Aprano

    Re: Any built-in ishashable method ?

    Steven D'Aprano, Jan 18, 2013, in forum: Python
    Replies:
    0
    Views:
    132
    Steven D'Aprano
    Jan 18, 2013
Loading...

Share This Page