title: Why does '.sort()' cause the list to be 'None' in Python?
body: <p>I am attempting to sort a Python list of <code>int</code>s and then use the <code>.pop()</code> function to return the highest one. I have tried a writing the method in different ways:</p>
  
  <pre><code>def LongestPath(T):    
      paths = [Ancestors(T,x) for x in OrdLeaves(T)]
      #^ Creating a lists of lists of ints, this part works
      result =[len(y) for y in paths ]
      #^ Creating a list of ints where each int is a length of the a list in paths
      result = result.sort()
      #^meant to sort the result
      return result.pop()
      #^meant to return the largest int in the list (the last one)
  </code></pre>
  
  <p>I have also tried </p>
  
  <pre><code>def LongestPath(T):
      return[len(y) for y in [Ancestors(T,x) for x in OrdLeaves(T)] ].sort().pop()
  </code></pre>
  
  <p>In both cases <code>.sort()</code> causes the list to be <code>None</code> (which has no <code>.pop()</code> function and returns an error). When I remove the <code>.sort()</code>  it works fine but does not return the largest <code>int</code> since the list is not sorted.</p>