python call constructor from class method code example
Example 1: python class call base constructor
class Base(object):
def __init__(self, value):
self.value = value
class Child(Base):
def __init__(self, something_else):
Base.__init__(value=20)
self.something_else = something_else
Example 2: python calling method from constructor
class TheBestClass:
def __init__(self, num1, num2)
self.number1 = num1
self.number2 = num2
self.AddTogether() #call it within self.
def AddTogether(self):
print(self.number1 + self.number2)