在Python中,给定一个列表,我可以通过关键函数对其进行排序,例如:>>>defget_value(k):...print"heavycomputationfor",k...return{"a":100,"b":30,"c":50,"d":0}[k]...>>>items=['a','b','c','d']>>>items.sort(key=get_value)heavycomputationforaheavycomputationforbheavycomputationforcheavycomputationford>>>items['d','b','c','a']如您所见,列表不