3 ms·
> `sort(arr)` returns a sorted copy of the input > `sort!(arr)` returns the sorted original Python has a naming convention as well: `sorted(arr)` returns a so
by pansa2 5y ago
> `sort(arr)` returns a sorted copy of the input
> `sort!(arr)` returns the sorted original
Python has a naming convention as well: `sorted(arr)` returns a sorted copy and `arr.sort()` works in-place (and returns None). However, I've always thought it's a bit odd that one is a function and the other is a method.