Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"The voters have spoken, the bastards..." -- unknown


devel / comp.lang.python / Re: Multiple inheritance and a broken super() chain

SubjectAuthor
o Re: Multiple inheritance and a broken super() chainChris Angelico

1
Re: Multiple inheritance and a broken super() chain

<mailman.158.1688409610.23016.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=28150&group=comp.lang.python#28150

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: rosuav@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: Multiple inheritance and a broken super() chain
Date: Tue, 4 Jul 2023 04:39:57 +1000
Lines: 24
Message-ID: <mailman.158.1688409610.23016.python-list@python.org>
References: <CAC-uhUARYKsk92r4BEDmDGx6wbyLZbrOeL1izwHurOUDjEbJJA@mail.gmail.com>
<CAPTjJmrf-hnPanva0pSpd121oHVum5QMKF4qwZLABJ4kUX-wrg@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de fbT1tFOcoR1O9TB0Vy2qGQ1uhVEmcVdd/0YxpbwWjGdw==
Return-Path: <rosuav@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=qLXNMzFa;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.016
X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'jul': 0.04; '2023': 0.07;
'example.': 0.09; 'instances': 0.09; 'moved': 0.09; 'textbook':
0.09; 'trivial': 0.09; 'chrisa': 0.16; 'classic': 0.16;
'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16;
'legacy': 0.16; 'received:mail-ed1-x52e.google.com': 0.16;
'subject:() ': 0.16; 'subject:super': 0.16; 'wrote:': 0.16;
'problem': 0.16; 'uses': 0.19; 'tue,': 0.19; 'to:addr:python-
list': 0.20; 'written': 0.22; 'code': 0.23; 'seems': 0.26;
'classes': 0.26; 'python-list': 0.32; 'message-
id:@mail.gmail.com': 0.32; "i'm": 0.33; 'there': 0.33; 'header:In-
Reply-To:1': 0.34; 'received:google.com': 0.34; 'one.': 0.35;
'from:addr:gmail.com': 0.35; 'using': 0.37; 'two': 0.39; 'both':
0.40; 'likely': 0.61; 'skip:b 10': 0.63; 'top': 0.65; 'let': 0.66;
'right': 0.68; 'order.': 0.69; 'waiting': 0.73; 'parents': 0.76;
'left': 0.83; 'happens': 0.84; 'diamond': 0.84; 'happen,': 0.84;
'subject:inheritance': 0.84; 'era,': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20221208; t=1688409608; x=1691001608;
h=content-transfer-encoding:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=NBBCPpU4v+vZLgSLSUlHfmfhP7hqUBOSrRp1regfWDc=;
b=qLXNMzFaIqicVoqQ1QJwBMnRbdLlHHYKla5huprZHR9Ba6XmrbDtuwt5v8cxF9kOFs
iXidNiC6QdXBJ4rzB7ZjugiWvtFAcspbXlXguZVK/+ghoE0fKFizQYhzVK5SPl+EAzJ7
fBbIh+lldemyyZ1ffXb1pcs3SCuge01830JjNe5ntYn62SF6tYj8+ax6jpoGHzqPsBuL
Ow8nwTUs+KLNbU5cmtatSjWrcr47wXj15FH7VQ54CoaZRyT4xO08tcrPi6SUuyXKEX3Z
zjHz4mqAPuzKpBHWDn636w9ehX9Muf/f2GPXzpWilhrwAqrFQDScrzjprm1eX2ObzQ+v
YtXg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20221208; t=1688409608; x=1691001608;
h=content-transfer-encoding:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=NBBCPpU4v+vZLgSLSUlHfmfhP7hqUBOSrRp1regfWDc=;
b=ldf07AWgTo5jBkUd6oPUUcWFlryjwa5CBaOXhNIlLr/QlwO/MY+B9hLq7T/1DgMoBj
e4uNgn5v/NPoXZwVdkYIu0hNiN9XjDPrRf3NO29/czHmySI9s2ehpB04OQzc0AGyBWqH
iMg8vhayrGbukJ70FUueh8O01iNFcV9TV2JJe9x8BG7VNfrfwOnR/3qCrkWK6dMY0dr6
2havnHKqnRXxjnisP6ZTfQctAq5jxTSXl6W9HdltM2x+hA/3YIRm5oGgGTn/DZHtzdv0
R1/jq4WH7axoBbo4RN3UopgOEWqzMc3bN9671RnkCjxq7ZDj9GHzXBGC9k/BLNAsnp6d
4xGQ==
X-Gm-Message-State: ABy/qLYSwYTzlZYHudcwfsBZHCR+CE0Hp0HhzI7Kg6E5Qq2bv1Dttb5v
iO2ee99K6Yzdi+5DUeaSTP4uuC+EFQ0YWylXqCYebJh/
X-Google-Smtp-Source: APBJJlESLuN/ciIQSQqmwi+qrwTwNUJCZ0ylw8/7fKr/CsVHgNb9tlnvg5KY+vkrHQ9cQJkA16IBHnd72uA0VSrOgpw=
X-Received: by 2002:a50:ed02:0:b0:51d:f7dc:8019 with SMTP id
j2-20020a50ed02000000b0051df7dc8019mr6173810eds.6.1688409608353; Mon, 03 Jul
2023 11:40:08 -0700 (PDT)
In-Reply-To: <CAC-uhUARYKsk92r4BEDmDGx6wbyLZbrOeL1izwHurOUDjEbJJA@mail.gmail.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAPTjJmrf-hnPanva0pSpd121oHVum5QMKF4qwZLABJ4kUX-wrg@mail.gmail.com>
X-Mailman-Original-References: <CAC-uhUARYKsk92r4BEDmDGx6wbyLZbrOeL1izwHurOUDjEbJJA@mail.gmail.com>
 by: Chris Angelico - Mon, 3 Jul 2023 18:39 UTC

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


devel / comp.lang.python / Re: Multiple inheritance and a broken super() chain

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor