let’s assume following C code:
// events.h
enum Events {eOne, eTwo, eThree};
enum Events getEvent(void);
…
//ctrl.c
#include "events.h"
void ctrl(void)
{
switch(getEvent())
{
case eOne:
// ...
break;
case eTwo:
// ...
break;
case eThree:
// ...
break;
default:
;
}
}
What is pythonic way to implement this? The simple way for me, is to use strings instead of enums, but how can I be sure that all strings are typed correctly (i.e. are the same in all files)?
The following Python code is similar to how your C code interacts. To use variables from another module you need to first import that module.
…