-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Unable to do the difference between kind() and type() for dtype in numpy.h #2860
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
Comments
Hi, @bemichel. If you don't mind, a PR would indeed be easier. If not, let us know, and someone can do it. By the way, in Python itself, it's >>> np.dtype(np.float32).char
'f'
>>> np.dtype(np.float64).char
'd' |
Hi @YannickJadoul, |
Oh, right. Of course, you're right... One way pybind11 deals with this is by using an extra underscore. Like @bstaletic, any thoughts? |
Hi, |
If that name also makes sense to you (does it?), then that would be perfect, yes :-) Thanks a lot :-) |
Hi,
We are using pybind11 to give access to Python/C++ arrays in on a numerical project. For this, we are using the pybind11:array_t.
But, we would like to have access to type attribute in the PyArray_Descr in API C or the dtype.char on Python interface, but only the kind() method is available in the class pybin11::dtype in numpy.h.
The kind method gives only the "general" kind of the dtype, i.e.
So it is not possible to distinguish float from double, or int from long int.
Only by adding a new method in the pybind11::dtype::type() for exemple which returns the type attribute from PyArray_Descr, like the following
It will be now possible to distinguish the effective type
Sorry, I am not sure if it is the good way to asking to add this little piece of code and/or if it is just possible ?
Should I create a merge request instead ?
Best regards,
Bertrand M.
The text was updated successfully, but these errors were encountered: