Re: Calling a variable inside a function of another class

2012-01-10 Thread Terry Reedy
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 dt is an attribute of an instance of the class. t = test() #

Re: Calling a variable inside a function of another class

2012-01-10 Thread Jean-Michel Pichavant
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

Re: Calling a variable inside a function of another class

2012-01-07 Thread Yigit Turgut
On Jan 7, 6:01 pm, Steven D'Aprano wrote: > On Sat, 07 Jan 2012 07:00:57 -0800, Yigit Turgut wrote: > > I am trying to call a variable located in a function of a class from > > main but couldn't succeed.Any ideas? > > You cannot access local variables from outside their function. That's why > they

Re: Calling a variable inside a function of another class

2012-01-07 Thread Steven D'Aprano
On Sat, 07 Jan 2012 07:00:57 -0800, Yigit Turgut wrote: > I am trying to call a variable located in a function of a class from > main but couldn't succeed.Any ideas? You cannot access local variables from outside their function. That's why they are called *local* variables. You probably want to

Calling a variable inside a function of another class

2012-01-07 Thread Yigit Turgut
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? -- http:/