class Material: def __init__(self, ID, density): self.ID = ID self.density = density DB = [] @staticmethod def GetMaterialIDs(): result = [] for m in Material.DB: result.append(m.ID) return result @staticmethod def Get(ID): for m in Material.DB: if m.ID == ID: return m return None Material.DB.append(Material('Stainless steel', density = 8.00)) Material.DB.append(Material('Aluminium', density = 2.71))