I want to be able to do this:
class base:
Dict = {'attribute_name': (0,4)}
class sub(base):
Dict['attribute_name'] = (5,10)
I know I can do this by just adding a class method that's called in the init method, but that seems like a bad practice as it repeats a redundant function call for every instance.
Dict in this case is a dictionary containing the names of attributes and the physical location of their values in a bin file. so I wanted to make a new subclass for each type of file. Each type of file contains the same information just in different locations, but may have a different method of reading and writing. Dict contains 50+ items, so it seems redundant to copy and paste the definition of the entire dictionary into every child class to change 2 or 3 values.
Do I just need to refactor the whole thing?