This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author josh.r
Recipients Epyxoid, gpolo, josh.r, serhiy.storchaka, terry.reedy, zach.ware
Date 2019-01-09.17:47:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1547056044.6.0.102696643795.issue35700@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-01-09 17:47:25josh.rsetrecipients: + josh.r, terry.reedy, gpolo, zach.ware, serhiy.storchaka, Epyxoid
2019-01-09 17:47:24josh.rsetmessageid: <1547056044.6.0.102696643795.issue35700@roundup.psfhosted.org>
2019-01-09 17:47:24josh.rlinkissue35700 messages
2019-01-09 17:47:24josh.rcreate