coerce dict keys to strings when sorting for python3 compat (#11039)
In python 2 you can sort dicts with hetroeneous types:
In [1]: d = {"z": 1, 1: 42, ("a", "b"): 100}
In [2]: sorted(d)
Out[2]: [1, 'z', ('a', 'b')]
In python 3 you get an error:
In [1]: d = {"z": 1, 1: 42, ("a", "b"): 100}
In [2]: sorted(d)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-5-01813638448d> in <module>()
----> 1 sorted(d)
Loading
Please sign in to comment