It sorts the list in place. Can you use sorted(item_list)? -Ryan Birmingham
On 26 February 2017 at 22:07, qhlonline <qhlonl...@163.com> wrote: > Hi, all > I have a suggestion that, the sort() member method of the list > instance, should return the 'self' as the result of list.sort() call. > Now list.sort() returns nothing, so that I can NOT write code like > this: > > res = {item: func(item) for item in item_list.sort()} > > It feels bad. > > Regards! > > > > > _______________________________________________ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/