On Wed, 2003-10-15 at 18:52, Guido van Rossum wrote: > > While we're hacking on [].sort(), how horrible would it be if we > > modified it to return self instead of None? > > -1000. This is non-negotiable. I have a trivial wrapper function sortcopy() in my I-wish-these-were-builtins module: def sortcopy(vals, cmpfunc=None): """Non in-place wrapper for list.sort().""" copy = list(vals) copy.sort(cmpfunc) return copy I use this more often than list.sort(), because most of the time performance and memory use is not an issue and code using the in-place version is irritatingly verbose. Maybe this is worth adding as a builtin, to satisfy the people that want a non in-place sort. Mark Russell
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4