> On 12 Jul 2019, at 15:12, Paulo da Silva <p_s_d_a_s_i_l_v_a...@netcabo.pt>
> wrote:
>
> Hi all!
>
> Is there any difference between using the base class name or super to
> call __init__ from base class?
>
> class C1:
> def __init__(self):
> ...
>
> class C2(C1):
> def __init__(self):
> C1.__init__(self) or super().__init__() ??
> ...
>
> I have been using super, but I see some scripts where the base class
> name is used.
If you get into the habit of always using super() you will avoid the cases
where its critical and you did not use it.
super() is always right (I think by design) but calling C1.__init__(self) can
go wrong and is often hard to debug.
Barry
>
> Thanks for any comments.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
https://mail.python.org/mailman/listinfo/python-list