13/18 New rule in Inheritance



From the code below, in greet function what is the purpose of other object?. This other.name seems to be new rule in this inheritance example. Not explained anywhere about this rule.

How the other.name works?

class Employee(object):
    def __init__(self, name):
        self.name = name
    def greet(self, other):
        print "Hello, %s" % other.name

class CEO(Employee):
    def greet(self, other):
        print "Get back to work, %s!" % other.name


other is just a variable for any employee object - the greet method needs 2 employees to greet. fe:

employee.greet(boss) - the first (employee) is greeting the other (boss)
print boss.name - with this you can check boss' name