Metaclass vs inheritance for predefined class creation
问题 I'm writing some code for a program that will be able to run some software, read the inputs/outputs and do some data processing along the way. For example: (this is not the real case, but just to give an idea) class MusicFile(object): extension = [""] def setup(self): #set up the data def runsoftware(self): #play the song class MP3(MusicFile): extension = [".mp3"] def setup(self): #setupMP3file def runsoftware(self): #runMP3software I have about 4 general classes, and then file extensions