+ 4
Why can't we use list as dictionary key in Python?
I had this question for some while in my mind while writing a code. Can anyone explain as to why and whether we can use list as dictionary keys?
3 odpowiedzi
+ 8
good question!
keys must be immutable. It is for your own safety.
Otherwise you could accidently destroy the dic.
+ 6
Because you are able to change list items and tuples not.