+ 2

[Solved] Does a class need a def?

Say I have a superclass with a function (self, etc.), do the subclasses need to have a def (whatever) or can they be blank?

7th Oct 2020, 2:55 PM
Kelly H. Milligan
Kelly H. Milligan - avatar
3 Antworten
7th Oct 2020, 3:13 PM
Russ
Russ - avatar
+ 5
All you need is something to go after the New class declaration or you will get IndentationError as the interpreter will expect some indented code. pass does just that - it does nothing but acts as a placeholder for the indented text block.
7th Oct 2020, 3:16 PM
Russ
Russ - avatar
+ 1
Yeah, I guess like that. Thanks!
7th Oct 2020, 3:14 PM
Kelly H. Milligan
Kelly H. Milligan - avatar