is it possible to determine which variable access through object. So we can give information at run time about variable used into program. For creating such scenario I have created following files. Please provide your input.
#!/usr/bin/env python
class Test(object):
"""Base args"""
def __init__(self):
self.args = "dummy"
self.parser = "test"
self.sub_parser = ""
if __name__ == '__main__':
base_args = Test()
Above is framework class which load information from hundread of files and create member like above
import first_check
class Second(object):
"""Base args"""
def __init__(self):
pass
def main():
base_args = first_check.Test()
d = base_args.args
print d
if __name__ == '__main__':
main()
Above is user class when engineer create object of Test class and access member of Test class
#!/usr/bin/env python
import importlib
import gc
def main():
lib = importlib.import_module('second_check')
lib.main()
if __name__ == '__main__':
main()
This is wrapper program where I am trying to load second_check and run program. if we look into second_check we have used only args member and rest is unused for second_check (parser, sub_parser). we can retrieve information only used member.
parser, sub_parser not used into second_check but it can used into another check. so it is not complete unused parameter. will it possible to get such info and print into third_class.
Comments
Post a Comment