Why are dictionary objects unhashable in Python?

0 votes
Hi all, quick question. As per the title, I wanted to know why we cannot put in any key of our choice of a dictionary type as a dictionary (dict)?

Does it mean that there is absolutely no way to have a dictionary with a key referring to another dictionary?

All help appreciated!
Feb 8 in Python by Anirudh
• 2,050 points
12 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Hi, it is not possible to hash a dictionary.

You might be wondering why. It is because they are actually mutable containers of data and it is as simple as that. 

So if the dictionary was hashed, then the contents of the hash table would vary/change along with the change in content respectively which doesn't make any sense with respect to data usage.

Hope this helped!

answered Feb 8 by Nymeria
• 3,500 points

Related Questions In Python

0 votes
2 answers

What are the types of dictionary in python?

There are 4 types of dictionary Empty Integer Mixed Dictionary with ...READ MORE

answered Feb 14 in Python by Shashank
• 1,350 points
35 views
0 votes
1 answer

what are "and" and "or" operators in Python?

AND - True if both the operands ...READ MORE

answered Apr 17, 2018 in Python by Johnathon
• 9,050 points
17 views
0 votes
1 answer

Deleting a dictionary entry in Python

Use pop(): mapping.pop("key_x") #key_x is a key entry Note ...READ MORE

answered May 2, 2018 in Python by Nietzsche's daemon
• 4,260 points
27 views
0 votes
1 answer

Why there is no do while loop in python

There is no do...while loop because there ...READ MORE

answered Aug 6, 2018 in Python by Priyaj
• 56,120 points
57 views
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
20 views
+4 votes
6 answers
0 votes
1 answer

Pycharm warning: Must implement all abstract methods in Python. Why?

n vote As expected, python itself recognises that ...READ MORE

answered Nov 9, 2018 in Python by Nymeria
• 3,500 points
220 views
0 votes
1 answer

How to get all related Django model objects in Python?

This actually gives you the property names ...READ MORE

answered Nov 14, 2018 in Python by Nymeria
• 3,500 points

edited Dec 18, 2018 by Nymeria 254 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.