I\'m used that in Objective-C I\'ve got this construct:
- (void)init {
if (self = [super init]) {
// init class
}
return self;
}
<
In Python, calling the super-class' __init__
is optional. If you call it, it is then also optional whether to use the super
identifier, or whether to explicitly name the super class:
object.__init__(self)
In case of object, calling the super method is not strictly necessary, since the super method is empty. Same for __del__
.
On the other hand, for __new__
, you should indeed call the super method, and use its return as the newly-created object - unless you explicitly want to return something different.