Josh Rosenberg <shadowranger+pyt...@gmail.com> added the comment:
Closing as rejected; to my knowledge, *no* built-in Python method both mutate an object and returns the object just mutated, precisely because: 1. It allows for chaining that leads fairly quickly to unreadable code (Python is not Perl/Ruby) 2. It creates doubt as to whether the original object was mutated or not (if list.sort returns a sorted list, it becomes unclear as to whether the original list was sorted as well, or whether a new list was returned; sortedlist = unsortedlist.sort() might give an inaccurate impression of what was going on). Zachary's example of using top-level functions to do the work instead is basically the same practicality compromise that sorted makes in relation to list.sort. ---------- nosy: +josh.r resolution: -> rejected stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35700> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com