Why don't I ever see the following in Python code?
class A:
def __init__(self, ...):
# something important
class B(A):
__init__ = A.__init__
It seems to work on my box with Python 2.5, 2.6, 2.7, and PyPy 1.8.
I see the following a lot, instead:
class B(A):
def __init__(self, *args, **kwargs):
A.__init__(self, *args, **kwargs)
or something using super
.
I like my first example better (explicit is better than implicit!) but I'm worried that it's not kosher for some reason. Is there something wrong or bad with it?
EDIT: Yep, I meant A.__init__
, not self.__init__