8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents bfaef9c + 0d8832e commit c8ed7e9Copy full SHA for c8ed7e9
numpy/ctypeslib.py
@@ -499,6 +499,22 @@ def as_ctypes_type(dtype):
499
`ctypes.Structure`\ s
500
- insert padding fields
501
502
+ Examples
503
+ --------
504
+ Converting a simple dtype:
505
+
506
+ >>> dt = np.dtype('i4')
507
+ >>> ctype = np.ctypeslib.as_ctypes_type(dt)
508
+ >>> ctype
509
+ <class 'ctypes.c_int32'>
510
511
+ Converting a structured dtype:
512
513
+ >>> dt = np.dtype([('x', 'i4'), ('y', 'f4')])
514
515
516
+ <class 'ctypes.Structure'>
517
518
"""
519
return _ctype_from_dtype(_dtype(dtype))
520
0 commit comments