Hey guys,
I've got a class defined has the following:
class TData(object) :
#Overriden constructor
def __init__(self, oc, via ):
self.oc = oc
self.via = via
now in a separate file I'm trying it iterate through that using recursion.
def search(critia, searchSpace, value) :
print "Calling search with " + critia
if(len(searchSpace) > 0) :
k=0
i = len(searchSpace)
k = searchSpace[0]+critia
print k
search(".ac" , p, 1)
whilst this is not recursion in itself, i'm struggling to understand how to gain access to the class variables. The "a.c" should be appended onto searchSpace. SearchSpace is a list containing objects of TData.
When i do
print searchSpace[0].ac it works, and I would expect it to. But what I'm trying to acheive at the end of the day is that
search should take a list of parameters - these will be values such as ["ac", "via"] and the recursion will go through each of these values, so far I cant get it to dynamically evaluate the expression
searchSpace[0]+"STRING"
I Hope this makes sense.