numpy indexing: shouldn't trailing Ellipsis be redundant?
问题 While trying to properly understand numpy indexing rules I stumbled across the following. I used to think that a trailing Ellipsis in an index does nothing. Trivial isn't it? Except, it's not actually true: Python 3.5.2 (default, Nov 11 2016, 04:18:53) [GCC 4.8.5] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import numpy as np >>> >>> D2 = np.arange(4).reshape((2, 2)) >>> >>> D2[[1, 0]].shape; D2[[1, 0], ...].shape (2, 2) (2, 2) >>> D2[:, [1, 0]].shape;