AI engineering glossary · Python advanced
What is __init__?
__init__: The special method Python calls right after a new object is created, used to set its starting attributes. It receives the new object plus any arguments passed when calling the class, and it must not return a value other than None.
__init__: an example
def __init__(self, name, age): self.name = name; self.age = age runs when you write Person('Meera', 29).
Related terms
More Python advanced terms
Where you learn it
__init__ is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.