A bit of an awkward use-case here. The intended functionality for the code I'm working on is to be able to load in molecules to a two-player game at runtime, and I've largely implemented a good chunk of the physics. I'm wondering if the functionality to look up a specific class type can be accessed in python for the part of the project I'm currently working on. I'm getting integer values from a class function in an imported library (chempy), and the function returns a dictionary of integers to represent which elements are present in a chemical formula, and in what quantity. I've got my own classes for element objects, and I'm trying to build a function which will take this dictionary of integers and construct the appropriate objects. For example, I might call it with the argument = {1:2,8:1} to signify water, because the chempy Substance.composition() method returns this value. My initial thought was that I should just have a list of the elements in the range that I'm intending to implement models of, such that the dictionary keys can be used to index the array. However, I'm not sure how to implement a list of class types, as opposed to pre-loaded objects. I'm imagining something like this: elements = [Hydrogen,Helium,Lithium,Beryllium,Boron,Carbon,Nitrogen,Oxygen]. I'm left wondering how to call a new object of instance elements() (??) where i is a dictionary key from the chempy function's return value. Is any of this valid code? I can't find related documentation online, which makes me wonder if this functionality is accessed through different means, or even really feasible in this language? Thanks! Continue reading...