I am a long-time C developer who is starting to use Python (more specifically 3.7.12) in some applications.
I am wondering if I can use something similar to the typedef enum structure that we have in C. My point is:
It is very useful when we create a variable that can only assume some values and the IDE provide hints to those possible values, like the following example:
typedef enum{
NO_ERROR_PC = 0,
ERROR_ERROR_PC = 1,
ERROR_CMD_NOT_KNOWN = 2,
...
}PC_COM_ERROR_T;
PC_COM_ERROR_T f_error;
switch(f_error){
//... compiler checks if there is anything missing,
//or if a case for a value that is not defined has been created...
}
void newFuction(PC_COM_ERROR_T error){
//makes very clear what values are accepted, provide hints and compiler checks
}
This is also very useful when we need to assign a value to f_error because the IDE already provide hints.
I have been wonder around, but I did not find anything that would perform as well as I need.