Yigit Turgut wrote:
class test(test1):def __init__(self, device): . . . def _something(self, x=1) self.dt = data if __name__ == "__main__": test.something.dt ??? I am trying to call a variable located in a function of a class from main but couldn't succeed.Any ideas?
if __name__ == "__main__": aTest = test(whateverdevice) print aTest.dt Some advices: - a common practice in python is to name classes in CamelCase ( read http://www.python.org/dev/peps/pep-0008/ ) - if dt is a shortcut for data, it's a bad one. - default values are for loosers, they should be used only to keep backward compatibility (personal opinion, a lot of ppl would disagree) - "call" is usually reserved for method and function, or any callable object in python. What you're trying to do is to reference an object, not calling it. JM -- http://mail.python.org/mailman/listinfo/python-list
