#!/usr/local/bin/python2 l = [6,2,8,4,2,0] def f(v): print v return v l.sort(key=f)