-1

By necessity, I'm translating a code to Python. But I encountered a structure which I do not know how to build in Python. Follows an example of the code:

typedef enum
{
    HCI_CMD = 1,
    ACI_CMD = 2
} hci_cmd_et;
Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
  • look here https://docs.python.org/3/library/enum.html – Hynek Bernard Dec 01 '20 at 13:42
  • So the goal is to translate this to Python or are you planning to wrap an existing C library in python? You can translate this to python using the enum package (standard library). If you are creating a python wrapper, you can define the enum values as constants. – jrast Dec 01 '20 at 13:43
  • @jrast Yes! The general goal is translate an archive from C to Python. – Luan Florencio Dec 01 '20 at 13:47

1 Answers1

1

You can see for enums in python

from enum import Enum
class hci_cmd_et(Enum):
    HCI_CMD = 1
    ACI_CMD = 2
Ramon Medeiros
  • 2,272
  • 2
  • 24
  • 41