1 답변
-
class NPArrayLike: def __init__(self, list): self._list = list def __getitem__(self, indices): return [self._list[idx] for idx in indices]; if __name__ == "__main__": out = NPArrayLike([1,2,3,4,6]) indices = [0,1,4,3,1,2,1] print(out[indices]) # [1, 2, 6, 4, 2, 3, 2]
에뮬레이션 해 보면 대략 이렇지 않을까요?
댓글 입력