In an attempt to solve this, I gave my item class only four characteristics, the name, cost, and weight (common to all items) and then a list of "nodes" defining additional object attributes. The thing is, due to the lack of internal order or count on the nodes being relevant (I don't want/need to know the individual node position) I was trying to simplify node modification along these guidelines:
Objects are subject to an upper limit of 1 node_container. I want to modify ctyp and size by using (item).size instead of (item).nodes[x].size, where x is the position of the node.
For attack and materials, I want to modify only the first instance of a node_attack. So, (item).dmg would actually modify (item).nodes[x].dmg, where x is the first instance of an attack node. In theory, it would be great if I could have a way to choose which attack to modify by modifying the call, but that's totally beyond me.
I'm also trying to modify the sort calls to sort the node list according to type, but I don't know how to determine which objects are in the list.
I was also wondering if I could use the set attribute call to modify the attribute in a freshly created node upon detection that the node currently doesn't exist, i.e. setting dmg would automatically add a node_attack to the item's node container. I started figuring out the get attribute calls, but I kept getting all sorts of crazy syntax errors I'd never even heard before.
I've currently tried this several different times, and the documentation on objects provides little to no help without examples as to how to actually implement it. I've been running in circles and Googling the heck out of it to no avail.
class item: name=str() cost=int() weight=int() nodes= def __repr__(self): return self.name def len(self): return len(self.nodes) def pop(n): return self.nodes.pop(n) def append(i): self.nodes.append(i) class node_attack: skname=str() dmg=int() acc=float() class node_container: ctyp=int() size=int() class node_material: matname=str() mat=int() vol=int() class node_feature: ftyp=int() detail=str()