Learn Before
Code

Code example for "self" keyword

class Employee: def __init__(self, id, name): self.id = id self.name = name

In the example above, the first parameter is self because when we create an object, its instance is automatically passed.

emp1 = Employee(1, Jon)

0

1

Updated 2021-02-02

Contributors are:

Who are from:

Tags

Python Programming Language

Data Science