I got this example here, and I think it might be a good example for my question:
class Employee:
def __init__(self ,first ,last ,pay ):
entry_gate = 10;
self.first = first
self.last = last
self.pay = pay
self.email = first+"."+last+"@company.com"
I have noticed that in some __init__
functions, there are variables that don't have a self.
in front of the variables. I understand all the self.
variables should be instance variables. Then, how about the variables that don't have a self.
within the constructor? Should I understand it as a class variable because it doesn't point to any instance? And is there a difference between class constructor and instance constructor if they both use __init__
as the function name?