I am writing a class which is basically a data structure to hold status codes and an associated dict with each status code. I want to call a method, providing a numeric status code and get a dictionary back.
class StatusCode(object):
def __init__(self):
self.codes = { 0: { 'flag': "QEX_OK", 'message': "job successful" },
1: { 'flag': "QEX_CMDLINE", 'message': "general cmd line syntax or semantic error" }
}
@staticmethod
def get_code(code):
return self.codes[code]
How would I correctly achieve this?
Much thx.