CS Electrical And Electronics
@cselectricalandelectronics

Why pass keyword is used in Python?

All QuestionsCategory: PythonWhy pass keyword is used in Python?
Chetan Shidling asked 4 years ago

I need short information.

1 Answers
Chetan Shidling answered 4 years ago

When you defined class and you want to ignore class at that time, pass is used. Let’s see one example.
 
class Computer:
        pass
 
c1 = Computer()
print(id(c1))
 
Otherwise you will face error, if you not use pass. The error will be.
 
IndentationError: expected an indented block.
 
To keep the class empty, pass is used.