Constructors are special functions called when an object is created, if a constructor is not defined manually Python creates one by default, the constructor is defined as __init__(self) and is used to initialize attributes.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
11 views
Python Constructor
Constructors are special functions called when an object is created, if a constructor is not defined manually Python creates one by default, the constructor is defined as __init__(self) and is used to initialize attributes.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 2
Python consturctor
Constructor
Constructor: constructor is a special function
which is called at the time of object creating If constructor is not difine manually then python bydefault create a constructor __init__(self): this is the constructor Def __init__(self): self.name = ‘ABC’ self.age = ‘23’