+ 1

Why can custom types be keys?

Objects for dict keys are supposed to be immutable and can not contain mutable elements. Yet you can define a class and take the class itself as a key, although you could add or delete attributes at runtime. What's the logic behind this?

26th Mar 2019, 2:26 PM
HonFu
HonFu - avatar
1 Antwort
+ 5
https://wiki.python.org/moin/DictionaryKeys
26th Mar 2019, 2:59 PM
Mert Yazıcı
Mert Yazıcı - avatar