python pass object as argument

Viewed 76889

How can I pass an object as an argument to a class method and call the method of the passed object when the class method is called?

Say I have:

class myclass:
    def __init__(self):
        pass
    def myfunc(self, something):
        something.do()


anobject = blah.xyz()

another_obj = myclass()
another_obj.myfunc(anobject)
3 Answers
Related