#๐ Why does the sort function this way?
13 messages ยท Page 1 of 1 (latest)
@zenith sail
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Yes, it compares the first item to sort. If there is a tie, it uses the second item to tie break. If its a tie, it goes to the 3rd item, etc.
wow thats cool, is that documented somewhere I could have found without having to bug you?
Hmm... I'm not sure, I'm not seeing it in the list documention: https://docs.python.org/3/tutorial/datastructures.html
ah well no worries just wanted to make sure I wasn't being a dummy and rtfm
thank you for the answer
@zenith sail when you're reading that page, you should also read the part about sort stability
I meant this page
I think I see, the sort I listed above is essentially doing what the stability and complex sort section is saying can be done in multiple steps in one
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.