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


Groups > comp.lang.python > #33021

Re: int.__init__ incompatible in Python 3.3

From Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com>
Newsgroups comp.lang.python
Subject Re: int.__init__ incompatible in Python 3.3
Date 2012-11-09 13:52 +0100
Message-ID <6tavm9-usn.ln1@satorlaser.homedns.org> (permalink)
References <481tm9-k6i.ln1@satorlaser.homedns.org> <CALwzid=bQXfhPz6mT30YOA+gJZKGHs--4XEPjPLDPEFvMM-T+Q@mail.gmail.com> <mailman.3463.1352406597.27098.python-list@python.org> <6ipum9-oim.ln1@satorlaser.homedns.org> <509ceb08$0$29980$c3e8da3$5496439d@news.astraweb.com>

Show all headers | View raw


Am 09.11.2012 12:37, schrieb Steven D'Aprano:
> On Fri, 09 Nov 2012 08:56:22 +0100, Ulrich Eckhardt wrote:
>> Or, do you suggest I don't call super().__init__()? That would seem
>> unclean to me.
>
> On the contrary: calling super().__init__ when the superclass does
> something you don't want (i.e. raises an exception) is unclean.
>
> Since the superclass __init__ does nothing, you don't need to call it.
> Only inherit behaviour that you actually *want*.


That one's hard to swallow for me, but maybe this is because I don't 
understand the Python object model sufficiently. The problem I have here 
is that not forwarding the __init__() to the baseclass could mean that 
necessary initializations are not performed, although in this very 
specify case I see that there aren't any. It still seems a bit like 
relying on an implementation details.

Anyhow, I'll have to do some more reading on the the construction of 
objects in Python, maybe then it'll all make sense. Until then, thanks 
everybody for nudging me in the right direction!

Uli

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


Thread

int.__init__ incompatible in Python 3.3 Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-11-08 16:55 +0100
  Re: int.__init__ incompatible in Python 3.3 Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-08 10:13 -0700
  Re: int.__init__ incompatible in Python 3.3 Terry Reedy <tjreedy@udel.edu> - 2012-11-08 15:29 -0500
    Re: int.__init__ incompatible in Python 3.3 Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-11-09 08:56 +0100
      Re: int.__init__ incompatible in Python 3.3 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-09 11:37 +0000
        Re: int.__init__ incompatible in Python 3.3 Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-11-09 13:52 +0100
        Re: int.__init__ incompatible in Python 3.3 Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-09 09:30 -0700
        Re: int.__init__ incompatible in Python 3.3 Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-11-12 14:48 +0100

csiph-web