About 366,000 results
Open links in new tab
  1. How does the key argument in python's sorted function work?

    The function you pass in to key is given each of the items that are being sorted, and returns a "key" that Python can sort by. So, if you want to sort a list of strings by the reverse of the …

  2. python - Sort a list of lists with a custom compare function - Stack ...

    I stumbled on this thread to sort the list of lists by comparator function. For anyone who is new to python or coming from a c++ background. we want to replicate to use of the call-back function …

  3. What algorithm does python's sorted() use? - Stack Overflow

    Jun 8, 2012 · Timsort was Python's standard sorting algorithm from version 2.3 to version 3.10. It is now also used to sort arrays in Java SE 7, and on the Android platform. Since 3.11, Python …

  4. What algorithm does Python's built-in sort () method use?

    Oct 4, 2009 · What algorithm is the built in sort() method in Python using? Is it possible to have a look at the code for that method?

  5. python - What is the difference between sorted (list) vs list.sort ...

    The .sort () function stores the value of new list directly in the list variable; so answer for your third question would be NO. Also if you do this using sorted (list), then you can get it use because it …

  6. python - Sort a list in reverse order - Stack Overflow

    Apr 16, 2017 · sorted is a built-in function that order your str element with an alphabetical algorithm, rather than just for reverse your sequence. Use help(sorted) in your kernal to see …

  7. Sort python list by function - Stack Overflow

    Aug 21, 2011 · A lambda function is useful if your sorting function takes a support argument, otherwise function name is enough. For example, if you want to sort list of string …

  8. sorting - How to sort with lambda in Python - Stack Overflow

    Sep 22, 2010 · You're trying to use key functions with lambda functions. Python and other languages like C# or F# use lambda functions. Also, when it comes to key functions and …

  9. Why does '.sort()' cause the list to be 'None' in Python?

    Mar 20, 2012 · I am attempting to sort a Python list of ints and then use the .pop() function to return the highest one. I have tried a writing the method in different ways: def LongestPath(T): …

  10. python - Sort a list by multiple attributes? - Stack Overflow

    Nov 20, 2010 · Here's one way: You basically re-write your sort function to take a list of sort functions, each sort function compares the attributes you want to test, on each sort test, you …