how to make sortable datatype in Python?
--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puddle Jumping Looping
--
Chapters
00:00 How To Make Sortable Datatype In Python?
00:56 Accepted Answer Score 13
01:12 Thank you
--
Full question
https://stackoverflow.com/questions/4630...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #sorting #datastructures
#avk47
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puddle Jumping Looping
--
Chapters
00:00 How To Make Sortable Datatype In Python?
00:56 Accepted Answer Score 13
01:12 Thank you
--
Full question
https://stackoverflow.com/questions/4630...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #sorting #datastructures
#avk47
ACCEPTED ANSWER
Score 13
Check out http://wiki.python.org/moin/HowTo/Sorting/
You want to override __lt__ in your class for the built in sort function to work the way you described.