First question, Is there a way to see what variables and object name where passed during creating class instance:
I have following classes:
class clCmd(object):
def __init__(self, testObj, cmd=None, template=None, option=None, optionList=None):
...
class test(clCmd):
def __init__(self, *args, **kwargs):
...
super(test, self).__init__(*args, **kwargs)
I am using this in this way:
t_rev3_test = 'blabla'
t_rev4_test = 'hellohello'
name = 'TEST1'
revision = t_rev3_test
tc_01 = testcase(name, revision)
a = test(tc_01, template=t_rev3_test)
Where testcase class is:
class testcase(object):
def __init__(self, name, revision):
...
Now, is there a way to see in the test class the object name 'tc_01' or the revision original variable name, so not the value that is passed but the actual name 't_rev3_test'?
My second, question is if i can find a way to compose a variable name (variable exists) from a string. I have read several other threads but couldn't figure it out how to implement it for my purpose!
example: totally simplified and not correct, i know, but something like that
t_rev3_test = 'blabla'
t_rev4_test = 'hellohello'
rev = '3'
tmp = 't_rev' + rev + '_test'
print tmp
should print: blabla