Sort a list on your own criteria with Python (pythonicprose.blogspot.com) 3 points by puttsmcfadden 15y ago ↗ HN
[–] sixtofour 15y ago ↗ I didn't notice until after I commented on the site that the post is from 2009.His call to sort reads like this:alist.sort(mysort)The ordering function doesn't sort, it orders. I would have called the ordering function myorder, so the call would read:alist.sort(myorder)More specifically, his ordering function orders by length, so even better would be:alist.sort(orderByLength)
1 comment
[ 4.6 ms ] story [ 10.5 ms ] threadHis call to sort reads like this:
alist.sort(mysort)
The ordering function doesn't sort, it orders. I would have called the ordering function myorder, so the call would read:
alist.sort(myorder)
More specifically, his ordering function orders by length, so even better would be:
alist.sort(orderByLength)