Mar-18-2024, 10:20 AM
There is no mention in the Documentation, that this method return a
But, it returns
I guess the expectation comes from
If the original order is also required, then use
None
.But, it returns
None
and sorts the list in-place.I guess the expectation comes from
str
. The str
methods always return a new str
, because str
is immutable.If the original order is also required, then use
sorted
. If you don't care about the previous order, just use the sort
method of the list instance. But do not assign the result to the name. Then the name refers to None and the list instance disappears after the garbage collector has done its work.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!