If l is a list, say [9,3,4,1,6], I know that l.sort() will sort the list in place. I also know that m=sorted(l) will create a new list, m, as a sorted version of l.
What I don't understand is why m=l.sort(), does not create m as a sorted version of l, since this appears to be an assignment of a sorted list to m. The problem can be seen from the following
In [37]: l = [9,3,4,1,6]
In [38]: m=l.sort()
In [39]: m
In [40]: type(m)
Out[40]: NoneType
Of course if I do the following, m becomes a sorted version of l
In [41]: l = [9,3,4,1,6]
In [42]: l.sort()
In [43]: m=l
In [44]: m
Out[44]: [1, 3, 4, 6, 9]
Can someone explain why m=l.sort() doesn't work as an assignment?