Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何从';家长';指针(元)类?_Python_Python 3.x_Ctypes - Fatal编程技术网

Python 如何从';家长';指针(元)类?

Python 如何从';家长';指针(元)类?,python,python-3.x,ctypes,Python,Python 3.x,Ctypes,假设如下: import ctypes class Point(ctypes.Structure): _fields_ = [ ('x', ctypes.c_double), ('y', ctypes.c_double) ] def some_routine(struct_pointer): # Do something to get '_fields_' from structure behind struct_pointer

假设如下:

import ctypes

class Point(ctypes.Structure):
    _fields_ = [
        ('x', ctypes.c_double),
        ('y', ctypes.c_double)
        ]

def some_routine(struct_pointer):
    # Do something to get '_fields_' from structure behind struct_pointer
    print(_fields_)

some_routine(ctypes.POINTER(Point))

在我的场景中,
类点
一些例程
都隐藏在不同的模块中。因此,我没有找到一种从
某些例程
中检索
类点
字段定义的方法。如何做到这一点?

您可以使用
stuct\u指针。\u type\u
引用
类。
\u type\u
正是我想要的-谢谢!您是如何在不同的模块中使用type打印Point的元素的?