Please, help me to understand why setting key parameter of SortedDict in the following code:
from sortedcontainers import SortedDict
SortedDict({1:2, 0:1}) # works
SortedDict({1:2, 0:1}, key=lambda x: x) # TypeError
SortedDict({'a':2, 0:1}, key=lambda x: 1 if isinstance(x,str) else x) # TypeError
gives the following error:
TypeError: '<' not supported between instances of 'int' and 'str'
How can one fix the examples? Thank you very much for your help!