For starters, do_that()
doesn't return anything. So calling it will pretty much do nothing.
self.B = B.do_that()
also won't work. You have to first create an instance of the class B
:
mything = B(your_parameters)
mything.do_that()
And if you want that to return something (i.e, the tuple), you should change your do_that()
to:
def do_that(self):
return (1, 2)
One final note, this can all be achieved through Inheritance:
class A(B): # Inherits Class B
def __init__(self,master):
"""Some work here"""
def do_this(self):
print self.do_that()[1] # This is assuming the do_that() function returns that tuple
Using the inheritance method:
>>> class B:
... def __init__(self, master):
... """Some work here"""
... def do_that(self):
... return (1,2)
...
>>> class A(B):
... def __init__(self, master):
... """Some work here"""
... def do_this(self):
... print self.do_that()[1]
...
>>> mything = A('placeholder')
>>> mything.do_this()
2