【发布时间】:2016-08-31 16:44:27
【问题描述】:
sortedWinnerIndices = winnerIndices[-numActive:][::-1]
谁能告诉我这里发生了什么?
WinnerIndices 长 2048 个整数,Numpy 数组。我在某处读到 [::-1] 反转了结果,但我仍然无法弄清楚这个函数是如何选择一个winnerIndices 子集的?
【问题讨论】:
-
魔力在于
[-numActive:],而不在于[::-1]。查看被接受的答案。
标签: python numpy operator-keyword colon