Skip to content

Conversation

wjakob
Copy link
Member

@wjakob wjakob commented Aug 27, 2018

This PR adds a new py::ellipsis() method which can be used in conjunction with NumPy's generalized slicing support. For instance, the following is now valid (where a is a NumPy array):

py::array b = a[py::make_tuple(0, py::ellipsis(), 0)];

@wjakob wjakob requested a review from jagerman August 27, 2018 22:26
a = m.create_and_resize(2)
assert(a.size == 4)
assert(np.all(a == 42.))

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flake8 error in CI:

./tests/test_numpy_array.py:412:1: E302 expected 2 blank lines, found 1
def test_index_using_ellipsis():

});

sm.def("index_using_ellipsis", [](py::array a) {
return a[py::make_tuple(0, py::ellipsis(), 0)];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must be excluded in python 2 tests

This PR adds a new py::ellipsis() method which can be used in
conjunction with NumPy's generalized slicing support. For instance,
the following is now valid (where "a" is a NumPy array):

py::array b = a[py::make_tuple(0, py::ellipsis(), 0)];
@wjakob
Copy link
Member Author

wjakob commented Aug 28, 2018

@ax3l : thanks!

@wjakob wjakob merged commit 885b5b9 into pybind:master Aug 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants