The Mysterious Key Type Conversion
We'll cover the following...
Let me show you a small magic trick, performed with the Python dictionaries.
Press + to interact
class SomeClass(str):passsome_string = 's'some_dict = {some_string: 42}print(some_dict.keys())some_instance = SomeClass('s')some_dict[some_instance] = 40print(some_string is some_instance)print(some_dict) # expected: Two different keys-value pairsprint(some_dict.keys())
Explanation
- This example is
...