Issue
The two following blocks of code should be equivalent:
Block 1
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]]
"""
Block 2
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]]
"""
But, in PyCharm, if I use:
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.
Solution
This is a bug in PyCharm.
Please see:
Answered By - Goku - stands with Palestine
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.