Is there a way of getting the index of an instance in an instance array by only knowing a property of that object?
I have something like this:
class NodeGene:
def __init__(self):
self.__initBias()
def __initBias(self):
#Creates a random bias and assigns it to self.bias
class ConnectionGene:
#nodeIn and nodeOut are instances of NodeGene
def __init__(self, nodeIn, nodeOut, innovationNumber):
self.nodeIn = nodeIn
self.nodeOut = nodeOut
self.innovationNumber = innovationNumber
self.__initWeight()
def __initWeight(self):
#Creates a random weight and assigns it to self.weight
class Genome:
def __init__(self, connections):
#connections is an array of ConnectionGene instances
self.connections = connections
How do I get the index of a ConnectionGene in connections if I have the nodeIn and the innovationNumber of the instance I am looking for?