【发布时间】:2019-07-04 08:58:53
【问题描述】:
我在 Python cffi 中定义了一个枚举。如何按名称实例化它? The docs say how to get the string name from enum,但不知道如何创建它。
ffibuilder = FFI()
ffibuilder.cdef('typedef enum { dense, sparse } dimension_mode;')
dim = ffibuilder.new('dimension_mode', 'sparse')
# E TypeError: expected a pointer or array ctype, got 'dimension_mode'
【问题讨论】:
标签: python enums python-cffi