On Tue, 4 Jul 2023 at 03:39, Peter Slížik via Python-list
<python-list@python.org> wrote:
>
> Hello.
>
> The legacy code I'm working with uses a classic diamond inheritance. Let me
> call the classes *Top*, *Left*, *Right*, and *Bottom*.
> This is a trivial textbook example. The classes were written in the
> pre-super() era, so all of them initialized their parents and Bottom
> initialized both Left and Right in this order.
>
> The result was expected: *Top* was initialized twice:
>
> Top.__init__() Left.__init__() Top.__init__() Right.__init__()
> Bottom.__init__()

What happens when Top is initialized twice? This seems like a problem
waiting to happen, and when you moved to using super(), you more than
likely simplified things and fixed things.

There are not two instances of Top to be initialized, only one.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to