The two following blocks of code should be equivalent:
array_1 = [[12, 15], [10, 1], [5, 13]]
print(array_1)
""" output:
[[12, 15], [10, 1], [5, 13]]
"""
print(sorted(array_1))
""" output:
[[5, 13], [10, 1], [12, 15]]
"""
import numpy as np
np_array_1 = np.array([[12, 15], [10, 1], [5, 13]])
print(np_array_1)
""" output:
[[12 15]
[10 1]
[ 5 13]]
"""
array_1 = np_array_1.tolist()
print(array_1)
""" output:
[[12, 15], [10, 1], [5, 13]]
"""
print(sorted(array_1))
""" output:
[[5, 13], [10, 1], [12, 15]]
"""
sorted(np_array_1.tolist()) # SEE BLOCK 2
I receive this only warning, but apparently without any issue:
Expected type 'Iterable[SupportsLessThan | Any]' (matched generic type 'Iterable[SupportsLessThanT]'), got 'object' instead
I would like to get clean code, thank you.
This is a bug in PyCharm.
Please see: