Action unknown: backlinkmenuitem

متغیر dict و class variableها

class Employee:

    num_of_emps = 0

    def __init__(self, first, last, pay):
        self.first = first
        self.last = last
        self.email = first + '.' + last + '@email.com'
        self.pay = pay
        Employee.num_of_emps += 1

    def fullname(self):
        return '{} {}'.format(self.first, self.last)

emp_1 = Employee('Masoud', 'Sadrnezhaad', 5000)
emp_2 = Employee('Mostafa', 'Amiri', 1000)

print(Employee.num_of_emps)

# print namespace of object. it don't have num_of_emps
print(emp_1.__dict__)

# But it has:
print(Employee.__dict__)