0

What is the different between hashable and hashobject in python?

3
  • Ask us something specific. What do you expect us to say that didn't already come up when you Googled Python hash? Commented Dec 6, 2016 at 20:55
  • This is not a tutoring service. Ask specific questions. Commented Dec 6, 2016 at 20:57
  • @ juanpa.arrivillaga well i edit my Quiz Commented Dec 6, 2016 at 21:00

1 Answer 1

2
  • Hashable

    • In general means an object has a hash value that never changes in its lifetime and can be compared to other objects. Thanks to those two features, a hashable object can be used as a key in a generic hash map
    • in python mmutable built-in objects are hashable while mutable containers (such as lists or dictionaries) are not. User-defined objects are by default hashable
  • Hashtable

    • in general, hash table (hash map) is a data structure used to implement an associative array, a structure that can map keys to values. Each key given a hash value through hash function for lookup
    • in python, dictionary is an implementation of hashtable
  • hash() in python

    • hash is a hash function that gives you a hash value (for the key inputed)
      In [1]: hash ('seed_of_wind')
      Out[1]: 8762898084756078118
      
    • As mentioned already, this distinctive 'id' is very useful for look up
    • in theory, a distinctive key will generate a distinctive hash value

By hash object, do you mean by hashable object? If so, it is covered above

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.