Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #30543

Re: Should one always add super().__init__() to the __init__?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.017
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'see.': 0.07; 'sep': 0.09; 'subclasses': 0.09; 'yet.': 0.13; 'sat,': 0.15; 'a(object):': 0.16; 'b):': 0.16; 'classes:': 0.16; 'inheritance': 0.16; 'mro': 0.16; 'worse.': 0.16; 'wrote:': 0.17; 'saying': 0.18; 'class.': 0.23; 'somebody': 0.23; 'pass': 0.25; 'header:In-Reply-To:1': 0.25; 'change,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'actual': 0.28; "d'aprano": 0.29; 'parent': 0.29; 'steven': 0.29; 'van': 0.29; 'class': 0.29; 'classes': 0.30; 'structure': 0.32; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'subject:?': 0.35; 'received:209.85': 0.35; 'next': 0.35; 'but': 0.36; 'depends': 0.36; 'quite': 0.37; 'received:209': 0.37; 'far': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'different': 0.63; 'sounds': 0.71; 'subject:always': 0.84; 'to:name:python': 0.84; 'subject:add': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=ZTd2pM0xD69y8EMhdgTV8rXcnXfAIJHGzQ9EfpszxEI=; b=a5tm2G/djTRyVGt/qoBHb//iqfxHYdVwvwgdL+1YRe8qqNKF1nIefAR72v7MY9GiMj 6bt94AMrpubOMO/HHC6aB4t7MACtRHojH/fjQMXYTyrUsJWVhxLmd0nipcaR2trzEobR 4nvKrObnDN19jpAVkEbWTAaLDyaKslY3MDYavM/tGBCkkmBDtIWv0OG4NZJZINHsKoFp BngBfU32aQsgxg6USrlAuyvKB4lQd51Q/cVM/PxSNgdPf7yrq7Q285RVsi4GR535Zr7S t9p831tP+iQkeZUvbGDk+Nh7mYmb+vQMEWRJmr1KpVkzyk2LXv30nBaH0FK8EGfRapOc 3o2w==
MIME-Version 1.0
In-Reply-To <5067cd36$0$29981$c3e8da3$5496439d@news.astraweb.com>
References <d8fc9d99-8dc0-4290-88a0-33cd38d09f7d@googlegroups.com> <50672d20$0$29981$c3e8da3$5496439d@news.astraweb.com> <mailman.1650.1348943511.27098.python-list@python.org> <m23920jy5a.fsf@cochabamba.vanoostrum.org> <5067cd36$0$29981$c3e8da3$5496439d@news.astraweb.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Sun, 30 Sep 2012 00:08:03 -0600
Subject Re: Should one always add super().__init__() to the __init__?
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1663.1348985321.27098.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1348985321 news.xs4all.nl 6978 [2001:888:2000:d::a6]:46069
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:30543

Show key headers only | View raw


On Sat, Sep 29, 2012 at 10:40 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> On Sat, 29 Sep 2012 17:51:29 -0400, Piet van Oostrum wrote:
>
>> It is not necesarily calling the parent class. It calls the initializer
>> of the next class in the MRO order and what class that is depends on the
>> actual multiple inheritance structure it is used in, which can depend on
>> subclasses that you don't know yet. This makes it even worse.
>
> I don't quite follow you here. It sounds like you are saying that if you
> have these classes:
>
> # pre-existing classes
> class A(object): pass
> class B(object): pass
>
> # your class
> class C(A, B): pass
>
> and somebody subclasses A or B, the MRO of C will change. That is not
> actually the case as far as I can see.

The MRO of C will not change, but the class that follows C may be
different in the MRO of a subclass.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Should one always add super().__init__() to the __init__? Ramchandra Apte <maniandram01@gmail.com> - 2012-09-29 06:27 -0700
  Re: Should one always add super().__init__() to the __init__? Ramchandra Apte <maniandram01@gmail.com> - 2012-09-29 06:28 -0700
  Re: Should one always add super().__init__() to the __init__? Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-29 10:59 -0600
  Re: Should one always add super().__init__() to the __init__? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-29 17:17 +0000
    Re: Should one always add super().__init__() to the __init__? Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-09-29 14:18 -0400
    Re: Should one always add super().__init__() to the __init__? Chris Angelico <rosuav@gmail.com> - 2012-09-30 04:31 +1000
      Re: Should one always add super().__init__() to the __init__? Piet van Oostrum <piet@vanoostrum.org> - 2012-09-29 17:51 -0400
        Re: Should one always add super().__init__() to the __init__? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-30 04:40 +0000
          Re: Should one always add super().__init__() to the __init__? Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-30 00:08 -0600
            Re: Should one always add super().__init__() to the __init__? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-30 09:34 +0000
              Re: Should one always add super().__init__() to the __init__? Manuel Pégourié-Gonnard <mpg@elzevir.fr> - 2012-09-30 14:04 +0200
      Re: Should one always add super().__init__() to the __init__? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-30 04:37 +0000
        Re: Should one always add super().__init__() to the __init__? Chris Angelico <rosuav@gmail.com> - 2012-09-30 14:53 +1000
        Re: Should one always add super().__init__() to the __init__? Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-30 01:13 -0600
    Re: Should one always add super().__init__() to the __init__? Ramchandra Apte <maniandram01@gmail.com> - 2012-09-29 20:14 -0700
      Re: Should one always add super().__init__() to the __init__? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-30 04:23 +0000
        Re: Should one always add super().__init__() to the __init__? Ramchandra Apte <maniandram01@gmail.com> - 2012-09-29 21:55 -0700
          Re: Should one always add super().__init__() to the __init__? Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-30 00:10 -0600

csiph-web