
It's even in the Programming FAQ: "In general in Python (and in all cases in the standard library) a method that mutates an object will return None to help avoid getting the two types of operations confused. So if you mistakenly write y.sort() thinking it will give you a sorted copy of y, you’ll instead end up with None, which will likely cause your program to generate an easily diagnosed error." Stephan 2017-03-01 10:31 GMT+01:00 Paul Moore <p.f.moore@gmail.com>:
On 1 March 2017 at 01:31, qhlonline <qhlonline@163.com> wrote:
My code example is not proper, Yes, may be this is better: list.sort().revers(
We can already do this - reversed(sorted(lst))
This is a long-established design decision in Python. It would need a *very* compelling use case to even think about changing it. Paul _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/