Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix new-style __init__ usage in numpy docs #2426

Merged
merged 1 commit into from
Aug 23, 2020

Conversation

YannickJadoul
Copy link
Collaborator

Fixes remaining issues after #2316 (see discussion there).

@@ -101,8 +101,8 @@ buffer objects (e.g. a NumPy matrix).
auto map = Eigen::Map<Matrix, 0, Strides>(
static_cast<Scalar *>(info.ptr), info.shape[0], info.shape[1], strides);

return Matrix(m);
});
return Matrix(map);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@bstaletic, so no new here, for you?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Either works. Let me find the wording from the docs.

https://pybind11.readthedocs.io/en/stable/advanced/classes.html#custom-constructors

One constructor return Example by value, one returns it in a unique_ptr and one returns a raw owning pointer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK, fair enough. Doesn't matter too much, then, but the less pointers the better? I guess Eigen will make sure things are movable...

@YannickJadoul YannickJadoul changed the title y Fix new-style __init__ usage in numpy docs Aug 23, 2020
Copy link
Collaborator

@bstaletic bstaletic left a comment

Choose a reason for hiding this comment

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

My bad...

@@ -101,8 +101,8 @@ buffer objects (e.g. a NumPy matrix).
auto map = Eigen::Map<Matrix, 0, Strides>(
static_cast<Scalar *>(info.ptr), info.shape[0], info.shape[1], strides);

return Matrix(m);
});
return Matrix(map);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Either works. Let me find the wording from the docs.

https://pybind11.readthedocs.io/en/stable/advanced/classes.html#custom-constructors

One constructor return Example by value, one returns it in a unique_ptr and one returns a raw owning pointer.

@YannickJadoul
Copy link
Collaborator Author

My bad...

Mine as well. I approved and merged ;-)

Just a simple fix, so I'm merging.

@YannickJadoul YannickJadoul merged commit 4493751 into pybind:master Aug 23, 2020
@YannickJadoul YannickJadoul deleted the fix-docs-numpy-init branch August 23, 2020 16:35
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