Defined class without the pass keyword
Created a class without the pass keyword at the end of the class and it worked perfectly.
Want to know why it worked without the pass keyword.
Below is the code and output.
1 answers ( 0 marked as helpful)
Hey Sylvester,
Thank you for your question!
Note that inside this class you have a docstring, namely:
''' Store patient information '''
This is not perceived as a usual comment, therefore your class is not 'empty'. Try substituting the above with
# Store patient information
or try removing it altogether. What you should get then is a parsing error. Therefore, in the absence of this docstring or any other piece of code, you should write pass
to create a placeholder for this class and avoid such errors.
Hope this helps!
Kind regards,
365 Hristina