Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
ef5a3804
Commit
ef5a3804
authored
Oct 22, 2016
by
Ivan Smirnov
Committed by
Wenzel Jakob
Oct 22, 2016
Browse files
A few dtype method docstrings
parent
f70cc112
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
include/pybind11/numpy.h
include/pybind11/numpy.h
+5
-1
No files found.
include/pybind11/numpy.h
View file @
ef5a3804
...
...
@@ -185,26 +185,30 @@ public:
m_ptr
=
from_args
(
args
).
release
().
ptr
();
}
/// This is essentially the same as calling numpy.dtype(args) in Python.
static
dtype
from_args
(
object
args
)
{
// This is essentially the same as calling np.dtype() constructor in Python
PyObject
*
ptr
=
nullptr
;
if
(
!
detail
::
npy_api
::
get
().
PyArray_DescrConverter_
(
args
.
release
().
ptr
(),
&
ptr
)
||
!
ptr
)
pybind11_fail
(
"NumPy: failed to create structured dtype"
);
return
object
(
ptr
,
false
);
}
/// Return dtype associated with a C++ type.
template
<
typename
T
>
static
dtype
of
()
{
return
detail
::
npy_format_descriptor
<
typename
std
::
remove_cv
<
T
>::
type
>::
dtype
();
}
/// Size of the data type in bytes.
size_t
itemsize
()
const
{
return
(
size_t
)
PyArrayDescr_GET_
(
m_ptr
,
elsize
);
}
/// Returns true for structured data types.
bool
has_fields
()
const
{
return
PyArrayDescr_GET_
(
m_ptr
,
names
)
!=
nullptr
;
}
/// Single-character type code.
char
kind
()
const
{
return
PyArrayDescr_GET_
(
m_ptr
,
kind
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment