J
Jeremy
I recently found the wiki page on sorting (http://wiki.python.org/moin/HowTo/Sorting/). This page describes the new key parameter to the sort and sorted functions.
What about custom objects? Can I just write __lt__, __gt__, etc. functionsand not have to worry about the key parameter? Is that the preferred (i.e.., fastest) way to do things or should I use a lambda function similar to what is given as an example on the wiki page?
For my custom objects, I would prefer to write the comparison functions as that seems easiest in my situation, but I would like to know what is the preferred/accepted way.
Thanks,
Jeremy
What about custom objects? Can I just write __lt__, __gt__, etc. functionsand not have to worry about the key parameter? Is that the preferred (i.e.., fastest) way to do things or should I use a lambda function similar to what is given as an example on the wiki page?
For my custom objects, I would prefer to write the comparison functions as that seems easiest in my situation, but I would like to know what is the preferred/accepted way.
Thanks,
Jeremy