-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Fix new-style __init__ usage in numpy docs #2426
Conversation
@@ -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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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...
There was a problem hiding this 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); |
There was a problem hiding this comment.
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.
Mine as well. I approved and merged ;-) Just a simple fix, so I'm merging. |
Fixes remaining issues after #2316 (see discussion there).