Why are the specs reversed in the following piece of code for multi-sorting on a bunch of object attributes?

后端 未结 0 1041
被撕碎了的回忆
被撕碎了的回忆 2021-01-03 08:21
def multisort(xs, specs):
    for key, reverse in reversed(specs):
        xs.sort(key=attrgetter(key), reverse=reverse)
    return xs

Documentation

相关标签:
回答
  • 消灭零回复
提交回复
热议问题