5 ms·
Or at least adopt a semantic preference that informs the user as to what is happening, e.g. Python has .sorted() for for non-mutating method vs .sort() for muta
by hcrisp 5y ago
Or at least adopt a semantic preference that informs the user as to what is happening, e.g. Python has .sorted() for for non-mutating method vs .sort() for mutating method.
- mgraczyk 5y ago`sorted()` is a builtin function, not a method. It can still be confusing, but it's more clear IMO that `sorted(array)` will not mutate vs a hypothetical `array.sorted()`.