Message333339
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. |
|
Date |
User |
Action |
Args |
2019-01-09 17:47:25 | josh.r | set | recipients:
+ josh.r, terry.reedy, gpolo, zach.ware, serhiy.storchaka, Epyxoid |
2019-01-09 17:47:24 | josh.r | set | messageid: <1547056044.6.0.102696643795.issue35700@roundup.psfhosted.org> |
2019-01-09 17:47:24 | josh.r | link | issue35700 messages |
2019-01-09 17:47:24 | josh.r | create | |
|