all AI news
Python super() vs Base.__init__ Method
Jan. 8, 2024, 8:58 a.m. | Bhavani Ravi
DEV Community dev.to
When defining a subclass, there are different ways to call the __init__ method of a parent class. Let’s start with a base class and go through each of these methods.
For this blog, it’s better that you open a sample.py python file and follow along.
class Base(object):
def __init__ (self):
print "Base created"
Method 1 :: Using Parent Reference Directly
class ChildA(Base):
def __init__ (self):
Base. __init__ …
More from dev.to / DEV Community
Jobs in AI, ML, Big Data
Founding AI Engineer, Agents
@ Occam AI | New York
AI Engineer Intern, Agents
@ Occam AI | US
AI Research Scientist
@ Vara | Berlin, Germany and Remote
Data Architect
@ University of Texas at Austin | Austin, TX
Data ETL Engineer
@ University of Texas at Austin | Austin, TX
DevOps Engineer (Data Team)
@ Reward Gateway | Sofia/Plovdiv