def __init__(self, color, legs):
self.color = color
self.legs = legs
4/17/2019 2:50:57 AM
Self is an object reference to the object itself. It is similar to this keyword of other programming languages.
Plz refer to this link :
You can use any valid variable name, it's just that self is convention. It is an instance of a class i.e object reference to itself.
It is the constructor in Python, strongly private with two underscores at the beginning.
GET THE FREE APP
Learn Playing. Play Learning
Send us a message